Ok, this is a 2 parter.
Part 1: when ever I kill an enemy it is supposed to make a ragdoll of the same object, and it does. But after a while of laying on the ground, the ragdoll goes jumps up about 300 feet into the air and when it lands, it waits a few seconds and launches up higher.
I made sure the colliders on the ragdolls are not touching each other, and it still goes flying
part 2: This one happens with switching between animations with the AI. An Idle animation plays when player is out of range, the running animation plays when it is within chase range and the shoot animation plays when it is in range to shoot. When ever it switches animations -for some reason- it glitches down into the ground. I know it isn’t the animations because they were made by me in blender and I know they are on the same co-ords.
This is the enemy AI in case if it is needed:
function Update(){
if(Distance < ChaseRange){
rigidbody.isKinematic = false;
Chase();
}
function LookAt(){
//renderer.material.color = Color.yellow;
if(animation.IsPlaying("Running") && Distance > ChaseRange){
animation.Stop("Running");
}
var rotation = Quaternion.LookRotation(Target.position - transform.localPosition);
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * Damping);
}
function Chase(){
// renderer.material.color = Color.red;
if(!animation.IsPlaying("fireandreload 1")){
animation.Play("Running");
}
moveDirection = transform.forward;
moveDirection *= MoveSpeed;
moveDirection.y -= gravity * Time.deltaTime;
controller.SimpleMove(moveDirection);
}
}
I would really appreciate any help on either problem because I cant figure out what is going on.
Can you please strip your code down a little bit? To do that you comment out sections of code until the error goes away, and then un-comment out the part that is contributing to the bug and edit your question to show only that portion of the code. Makes it easier for us folk to help you :)
– kiwi_koderThere isn't any error, it just jumps down about 2 feet into the ground. Also, I think that it has something to do with Simplemove.
– CoreyRB