- Home /
Rigidbody Position Changes don't work when moving.
Ok, I am in the process of making a pickup/hold system for my game. To make the object behave realistically, I am trying to make it move backwards when it collides with an object.
This works fine, the Rigidbody moves backwards when I walk into an object. The problem comes when I call rigidbody.position OR rigidbody.MovePosition to move the object back to the desired hold position.
The line only seems to work when I stop moving my Character. I am calling the function within a Coroutine that fires at the end of every FixedUpdate, and am logging the line before the move to see if it gets called. It does. It just does nothing.
Am I derping out here and forgetting something important?
Here are the two lines that actually do anything:
Debug.Log ("Moving...");
m_CurrentlyHeldItem.GetComponent<Rigidbody>().MovePosition(m_HoldPoint.position);
The rigidbody is not kinematic, has rotation frozen, and no gravity. Player moves using a C# version of the character motor, with small modifications, none of which are being used at this point. As such player is a Character Controller, and collision with the player is disabled while the object is held by changing the layer. So it does not collide with the player.
Your answer
![](https://koobas.hobune.stream/wayback/20220611234014im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Inconsistency in Rigidbody.MovePosition 0 Answers
Rigidbody.MovePosition not behaving as expected (possible bug?) 1 Answer
Rigidbody MovePosition doesnt use continous dynamic setting 1 Answer
Rigidbody.MovePosition() is not working if transform.position is just changed 1 Answer
What is the best way to move the player with physics without using MovePosition? 0 Answers