Search Issue Tracker

Fixed in 5.0.2

Votes

0

Found in

5.0.0f4

Issue ID

690124

Regression

No

MovePosition: gravity moves transform, not rigidbody

Physics2D

-

To reproduce in the attached project:

1) Play the "mainscene" scene in the "Assets" folder
2) Make sure the "Do Null Moves" box on the Player script (on the Player gameobject) is unchecked.
3) Once gravity has moved the player down to the platform, use the left and right arrow keys to move the Player via MovePosition.
4) Observe the buggy behavior -- the Player's sprite will penetrate the platform by about 1 frame's worth of gravity. The penetration is not cumulative, and corrects one frame after letting up on the movement keys (probably as the transform used for rendering resyncs with the Rigidbody's position)
5) Replay the scene from the start, this time checking the "Do Null Moves" box. This will make it so that MovePosition will be called even if there is no movement needed (the Player will simply do MovePosition to the rigidbody's current position).
6) Note that the player is perpetually one frame's worth of gravity BELOW its starting position. The fact that the Player is not consistently moving DOWN indicates that gravity is moving the TRANSFORM of the Player, but not the rigidbody*. This behavior is potentially responsible for the penetration (and delayed correction) produced in steps 1-4. This shows that the behavior has nothing to do with collision (since steps 5-6 do not produce any collisions).

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.