|
Post by darthfarter on Jun 2, 2019 11:32:10 GMT
I have posted Invector a project that shows the stuck in place AI.
|
|
|
Post by magique on Jun 2, 2019 14:48:26 GMT
I have posted Invector a project that shows the stuck in place AI. Awesome. I'm glad it wasn't just me. We are obviously getting the same results.
|
|
|
Post by Invector on Jun 4, 2019 20:02:02 GMT
Are you guys sharing the same SimplePool script? Anyways, darthfarter in the first project you sent to me it was working as expected with the modifications we posted before. The thing is, you have modified the SimplePool script since them and add a delay to disable the AI and that change how things work. Initially, you used to call 'GameObject.SetActive(false)' in the OnDead Event along the the SimplePool.EnemyDead. And now you only call the EnemyDead but since you've add a Delay to your script, the AI can run the internal scripts a little further and call the line: if (isGrounded && isDead) { _rigidbody.isKinematic = true; _capsuleCollider.enabled = false; } Meaning that the Rigidbody is now Kinematic (won't move), but you guys didn't Reset this value when the AI Respawns, that's why he is locked in place. All you need to do is reset this back to false, in your case you can use your own SimplePool script: IEnumerator RespawnTimer() { AI.GetComponent<CapsuleCollider>().enabled = true; fsmController.ResetFSM(); healthController.ResetHealth();
yield return new WaitForSeconds(spawnTimer);
// reset's the rigidbody.isKinematic in order to unlock movement AI.GetComponent<Rigidbody>().isKinematic = false; AI.gameObject.SetActive(true); }
|
|
|
Post by magique on Jun 4, 2019 20:05:48 GMT
Are you guys sharing the same SimplePool script? Anyways, darthfarter in the first project you sent to me it was working as expected with the modifications we posted before. The thing is, you have modified the SimplePool script since them and add a delay to disable the AI and that change how things work. ... I use PoolBoss in Core GameKit. However, I will try doing those last 2 lines of code and see if it helps for me.
|
|
|
Post by Invector on Jun 4, 2019 20:09:26 GMT
It's like I post before, in order to reset the AI you will need to reset a few variables.
ps* it's actually just one line > AI.GetComponent<Rigidbody>().isKinematic = false;
|
|
|
Post by darthfarter on Jun 4, 2019 21:05:31 GMT
I just made up that script for the demonstration purpose. Since we are not told what to activate/deactivate to renable a dead AI we have to experiment. So i have modified the script that lets the ai fall to ground before disabling it and now we learned that iskinematic is set to true. So all this is learn by doing since there is no simple checkbox that let you have all this features changed witch i find it very strange since this asset is so complex. Anyway thanks for looking in to this. I havent tried this out yet will see if i can make it work.
|
|
|
Post by magique on Jun 5, 2019 1:03:50 GMT
For me this is getting closer, but still having issues. Now the AI seem to be properly acting on respawns, but when I kill them, they don't die. They just stand there and are no longer active and moving. So, not sure what's preventing them from doing their death animations, etc. They are definitely alive with full health when they respawn and they attack and patrol as expected.
|
|
|
Post by Invector on Jun 5, 2019 17:24:44 GMT
The only variable to trigger the Dead animation is the IsDead, did you check if it reset's back to false once you pool the AI?
|
|
|
Post by magique on Jun 5, 2019 17:49:17 GMT
The only variable to trigger the Dead animation is the IsDead, did you check if it reset's back to false once you pool the AI? I don't know, but you are kind of missing the whole point of what we are asking for. If the components requiring reset simply had a ResetAI function on them that included all these details then all we would need to call is ResetAI even if it's on 2 separate components. This would include resetting health, making sure it's not considered already dead, etc. I would think it thinks it's alive because when I pause the game and look at the Health, they have a value and it's green. But maybe not. [EDIT]Actually, maybe there could be a static ResetAI function that would take a GameObject as a parameter and this static function could get the FSM and vControlAI components from the object if they exist and call Reset functions on them. Then we could do everything needed with a single function call, including all these little details like resetting health, etc.
|
|
|
Post by magique on Jun 6, 2019 14:17:36 GMT
Resetting isDead = false doesn't fix it. Now after I kill them, they just perform a back up animation and go off away from the player, but can no longer function.
|
|
|
Post by Invector on Jun 7, 2019 13:33:42 GMT
That's what we're trying to do here magique, a way to Reset the AI but it's not so simple as you saw just 1 little thing that darthfather did on his script it changed the order and it didn't respawn correctly, but here was working fine.
I don't know how you're doing the pooling or how the asset you're using works, that's why we need to figure it out what's not resetting for you.
|
|
|
Post by magique on Jun 7, 2019 13:46:05 GMT
That's what we're trying to do here magique, a way to Reset the AI but it's not so simple as you saw just 1 little thing that darthfather did on his script it changed the order and it didn't respawn correctly, but here was working fine. I don't know how you're doing the pooling or how the asset you're using works, that's why we need to figure it out what's not resetting for you. Sorry, I'm not trying to be mean or anything. To me it seems like you should be creating your own scene with a pooling system that has a player character and some AI and then test it thoroughly. Set your pool to create about 3 enemies at any one time and have them spawn 3 at a time. When they die, have the scene wait for a few seconds and then spawn those same 3 enemies again. Implement whatever resetting you need and see how it works. Once you have it working correctly, provide that scene as an example in the AI asset. I could try it here and see how it works for me. If it works then I could take the example and adapt it to what I'm already doing. Do you currently have your own completely working example scene that works with the changes you've specified?
|
|