- Home /
Question by
Redlazer · Jun 30, 2011 at 02:48 AM ·
wheelcollidermotortorquestalling
My AI controlled car "stalls" after making a turn based on a collider
Hello,
I'm having some trouble with my WheelColliders. I have four on a vehicle that I want to turn right when it enters an area (or crosses a threshold).
The Car has the following move() method:
void Move()
{
RRWheel.motorTorque = 5;
RLWheel.motorTorque = 5;
Debug.Log(RRWheel.motorTorque);
Debug.Log(RLWheel.motorTorque);
if (collided)
{
if (collided.gameObject.tag == "TriggerWall")
{
FRWheel.steerAngle = 45;
FLWheel.steerAngle = 45;
RRWheel.motorTorque = 10;
RLWheel.motorTorque = 10;
collided = null;
}
}
}
The debug log shows that there is torque being applied the whole time, even after it stops moving.
I am calling Move() from the FixedUpdate() method.
Anyone have any thoughts?
Thanks,
Fred
Comment
Answer by Redlazer · Jun 30, 2011 at 06:19 AM
Ah! Looks like I figured it out:
I think I was turning the wheel too fast. A lower angle appears to totally solve the problem.