I know this is an old question and it has been answered for a lot of people. Unfortunately none of the solutions apply to the problem I seem to have with rigidbodies.
I have a moving AI character and the playermodel. When the AI gets to close the player just bumps on top of it. If I unattach the rigidbody from the moving AI this does not seem to be a problem. My player is controlled by a charactercontroller and the rigidbody is set to "Is Kinematic".
Of course, when none of the agents has a rigidbody my entire combat mechanic falls apart. Does anyone have any idea on how to solve this?
For clarity, here is a short demonstration of the bug: Bump
And the code in question:
void FixedUpdate ()
{
if (!controller.isGrounded)
{
movement.y -= gravity * Time.deltaTime;
}
controller.Move (movement * Time.deltaTime);
}
void CalcMovement (float h, float v)
{
movement = new Vector3 ();
if (v != 0 || h != 0) {
movement = v * forward + h * right;
movementDirection = movement.normalized;
}
}
Is Kinematic
enabled? I'm sure if it is not, then at least AI can push you little bit. And can you explain what are you doingOnCollisionEnter
? \$\endgroup\$