- Home /
need help on unity phsyics, rigidbody acts weird after upgrading from unity 4.x to 5.x
Its a racing game, the game runs well in unity 4.x, but after i upgraded it to unity 5.x, the physics doesnt work well as in unity 4.x, the rigidbody velocity massively increased and goes berserk, the rotation acts weird as well. Ive been thinking that the problem is on the mass/gravity/collider, i tried to change the physics gravity from -50 to 0 and the car runs well, but thats not the solution.
heres how it look : http://www.giphy.com/gifs/ipLVKudit4rEKnWPWR
heres how it supposed to work : http://www.giphy.com/gifs/fQAET0xh0fs9y8Elej
this is the rigidbody that is attached to the cars
this is where the addforce is implemented
if (canDrive) {
if (this.id == BaseCarManager.mainPlayerID) {
if (IsDrift == false) {
if (throttle >= 0) {
if (ProfileManager.setttings.ControllerTilt == true) {
if (steer < -0.5f || steer > 0.5f) {
rigidbody.AddForce (transform.forward * Time.fixedDeltaTime * engineForceValues [0] * rigidbody.mass * CurrentAccelerationFactor * HandlingFactor, ForceMode.Force);
} else {
rigidbody.AddForce (transform.forward * Time.fixedDeltaTime * engineForceValues [0] * rigidbody.mass * CurrentAccelerationFactor, ForceMode.Force);
}
} else {
rigidbody.AddForce (transform.forward * Time.fixedDeltaTime * engineForceValues [0] * rigidbody.mass * CurrentAccelerationFactor, ForceMode.Force);
}
} else {
this.IsDrift = false;
rigidbody.AddForce (transform.forward * Time.fixedDeltaTime * throttle * engineForceValues [0] * rigidbody.mass, ForceMode.Force);
}
} else {
rigidbody.AddForce (transform.forward * Time.fixedDeltaTime * engineForceValues [0] * rigidbody.mass * CurrentAccelerationFactor * HandlingFactor, ForceMode.Force);
}
} else {
if (isNeedSlower == true) {
rigidbody.AddForce (transform.forward * Time.fixedDeltaTime * engineForceValues [0] * rigidbody.mass * CurrentAccelerationFactor, ForceMode.Force);
} else {
rigidbody.AddForce (transform.forward * Time.fixedDeltaTime * engineForceValues [0] * rigidbody.mass * CurrentAccelerationFactor * 2, ForceMode.Force);
}
}
}
any help guys? been trying to fix this for a day but still not able to fix it
Your answer
Follow this Question
Related Questions
2D 360 degress platformer example needed 0 Answers
How is drag applied to force? 3 Answers
Help with orbits 1 Answer
[Physics]Forklift Problem. 1 Answer
Would it be possible to record animations in playmode? 1 Answer