Hey Guys,
how do I use motorTorque properly?
I want my car to drive let’s say 10 units per second. I don’t get it oO How does motorTorque work?
Bigabig
Hey Guys,
how do I use motorTorque properly?
I want my car to drive let’s say 10 units per second. I don’t get it oO How does motorTorque work?
Bigabig
Simple, It powers your car.
You should times it by a torque/acceleration value and an Input value.
var torque : float = 600;
RL.motorTorque = Input.GetAxis("Vertical") * torque;
RR.motorTorque = Input.GetAxis("Vertical") * torque;
Tweak the torque value to whatever like.
well that is certainly not what i meant^^
ok, in physics torque is defined as
M = r * F
(M = torque, r = Radius, F = Force)
In Unity I have a car with 4 wheels, each wheel has a radius of r = 0.2m. Great!
So, when i set motorTorque to let’s say M = 100:
F = M / r = 500.
Now, I want an exact acceleration a = 10 m/s². Newton said:
F = m * a
(F = Force, m = Mass, a = Acceleration)
My Question is, what mass does Unity use to calculate that stuff? I attached a rigidbody to my car in Unity and changed the mass, however, nothing happend. Then, I changed the mass on the WheelCollider Component. This works, but the mass doesn’t seem to be in kg…
I have no idea how to handle torque in the right way…
Did all of the components of the car have rigidbody? By default I believe that ech rigidbody has a 1unit mass. I’m not sure there even is a real equivalent of the unit though, you may have to play around with values until it “feels right”