- Home /
Rigidbodies looks jerking on high speed.
Hello, my game is about racing the traffic . The issue is whenever i go high speed traffic cars looks like jerking while passing away and they look smooth if i get slow. Player car is smooth at both high and low speeds. I am using addForce for moving traffic cars. I cannot understand weather the problem is with camera or traffic objects rigidbody or anything else. Please help
Set the affected rigidbodie's interpolation mode to interpolate. $$anonymous$$ove the camera in LateUpdate()
And provide some code ;)
Camera is in LateUpdate . Tried interpolate but still not difference .
This is traffic car script with rigidbody mass of 1000 and Interpolate None
if(traffic_brake.collisiondetected) {
applyBrake();
}else if(currentSpeed>topSpeed)
{
rigidbody.AddForce(carforwarddirection_vector*0);
rigidbody.AddForce(carreversedirection_vector*0);
}else{
rigidbody.AddForce(carforwarddirection_vector*force);
rigidbody.AddForce(carreversedirection_vector*0);
}
I have tried moving physics to FixedUpdate, LateUpdate, Update
Note: Player car looks very smoothly moving at high and low speeds.
How is the if condition evaluated? What is applyBreak() doing? Why are you applying zero forces (remove those AddForce)?
I checked removing rigidbody.AddForce(carreversedirection_vector*0); but still same. Co$$anonymous$$g to applyBrake below is the method
function applyBrake() { rigidbody.AddForce(carforwarddirection_vector*0);
if(!this.gameObject.rigidbody.is$$anonymous$$inematic)
{
rigidbody.velocity =0.9*traffic_brake.oppositeCarSpeed;
}
}
Answer by Zielscheibe · Jun 08, 2017 at 11:29 AM
Additionally to the answer of @kornstar83 you may check the interpolation field on your rigidbody and set it to interpolate. I had that issue too with none for interpolation mode.
Answer by kornstar83 · Jun 08, 2017 at 11:24 AM
Check to make sure your physics calculations for the traffic cars are being done in a FixedUpdate, doing physics calculations in Update can cause that issue
Your answer
Follow this Question
Related Questions
Why is my camera shaky in editor but not in compiled project? 4 Answers
Background sprite tile movement jerks and flashes with black lines 0 Answers
Loadingscreen and play Level when initialized completely 1 Answer
Problem of jerking with the FreeLookCam script of Unity. 1 Answer
Jerky movement of camera 1 Answer