- Home /
How to make rigidbody.AddForce and controller.Move work together?
Whenever I have rigidbody's AddForce command do something, the character controller's Move command overrides it and keeps it in place. And when I temporarily disable the controller's Move command to let AddForce do its job, it works. But right when I re-enable Move, it teleports the object back to where it was before AddForce did anything to it. Is there any way to get around that or do I have to find an alternative method for what I want to do?
This is my code that I'm referring to.
Code 1 (.Move script):
groundedPlayer = controller.isGrounded;
playerVelocity.y += gravityValue * Time.deltaTime;
controller.Move(playerVelocity * Time.deltaTime);
Code 2 (.AddForce script):
if (isRevRolling)
{
rb.AddForce(transform.forward * revSpeed * 1.15f);
}
Comment