- Home /
How to synchronize translation with physics?
This has bothered me for a long while.
So basically there is a camera attached to a player and the player moves by getting axis value and translate with that value, which is done in update with deltaTime. At the same time I also have physics in the game where things move along in a constant speed. And these two things combine caused my problem: the physics based object is always moving choppily if I move the player at the same time which the camera follows, due to the fact that translation is not physics drive but bullet is and this caused the camera unable to synchronize with the physics movement.
I have tried using fixedUpdate instead of update for player translation with both deltaTime or fixedDeltaTime, but none of them seem to work for me. I was running it in editor. Anyone know how to solve this issue?
P.S. I'm confused with update, fixedUpdate, deltaTime, fixedDeltaTime. I know the definitions of all of them but can't clearly explain what they do. I know update is used along with deltaTime. But I'm not sure if I should use any deltaTime/fixedDeltaTime in my fixedUpdate section. All the complications makes me unable to solve this problem. Please advise.
Answer by Partel-Lang · Aug 28, 2013 at 07:05 AM
You can set the Rigidbody component to approximate it's position between the physics time step (between two FixedUpdates). Just set the Rigidbody to Interpolate or Extrapolate in the inspector.
There is a quick explanation of Update, FixedUpdate, LateUpdate and deltaTime in ExecutionOrder