Skip to main content
replaced http://gamedev.stackexchange.com/ with https://gamedev.stackexchange.com/
Source Link

Don't set the position explicitly.

When you set properties like position and even velocity, you do so outside the physics loop, so it has no chance to correct itself within the current frame, so you see jittering behaviour. In other words, in the current frame you'll reposition the body, possibly colliding into another body, and the physics system must correct this in the next frame. Consider this passage from the Rigidbody.velocity manual page:

In most cases you should not modify the velocity directly, as this can result in unrealistic behaviour. Don't set the velocity of an object every physics step, this will lead to unrealistic physics simulation.

If possible, always try to do it the recommended way - by adding forces by using functions like AddForce. This lets the physics system apply the right transformations, without temporary collisions.

This answerThis answer also contains similar advice.

Don't set the position explicitly.

When you set properties like position and even velocity, you do so outside the physics loop, so it has no chance to correct itself within the current frame, so you see jittering behaviour. In other words, in the current frame you'll reposition the body, possibly colliding into another body, and the physics system must correct this in the next frame. Consider this passage from the Rigidbody.velocity manual page:

In most cases you should not modify the velocity directly, as this can result in unrealistic behaviour. Don't set the velocity of an object every physics step, this will lead to unrealistic physics simulation.

If possible, always try to do it the recommended way - by adding forces by using functions like AddForce. This lets the physics system apply the right transformations, without temporary collisions.

This answer also contains similar advice.

Don't set the position explicitly.

When you set properties like position and even velocity, you do so outside the physics loop, so it has no chance to correct itself within the current frame, so you see jittering behaviour. In other words, in the current frame you'll reposition the body, possibly colliding into another body, and the physics system must correct this in the next frame. Consider this passage from the Rigidbody.velocity manual page:

In most cases you should not modify the velocity directly, as this can result in unrealistic behaviour. Don't set the velocity of an object every physics step, this will lead to unrealistic physics simulation.

If possible, always try to do it the recommended way - by adding forces by using functions like AddForce. This lets the physics system apply the right transformations, without temporary collisions.

This answer also contains similar advice.

Source Link
congusbongus
  • 14.9k
  • 58
  • 89

Don't set the position explicitly.

When you set properties like position and even velocity, you do so outside the physics loop, so it has no chance to correct itself within the current frame, so you see jittering behaviour. In other words, in the current frame you'll reposition the body, possibly colliding into another body, and the physics system must correct this in the next frame. Consider this passage from the Rigidbody.velocity manual page:

In most cases you should not modify the velocity directly, as this can result in unrealistic behaviour. Don't set the velocity of an object every physics step, this will lead to unrealistic physics simulation.

If possible, always try to do it the recommended way - by adding forces by using functions like AddForce. This lets the physics system apply the right transformations, without temporary collisions.

This answer also contains similar advice.