Hello, I’am working on a car script and i would like the car to move forward when I press “W” for example
The car already has working WheelColliders, but how do I add force to the car in the car’s direction?
Thanks, Andreas ![]()
Hello, I’am working on a car script and i would like the car to move forward when I press “W” for example
The car already has working WheelColliders, but how do I add force to the car in the car’s direction?
Thanks, Andreas ![]()
rigidbody.addForce(transform.forward);
I can't seem to get it work, I put it in the Update void, but it has no effect on the car (the script is in the same gameobject as the rigidbody)
– AndreasX12transform.forward * speed though you put it in void FixedUpdate (rididbodies only apply during fixedupdate) that shoudlnt have stopped it form working though where is the blue line in the car when you select it in editor with local axes
– sparkzbarcaim thinking your car is misoriented
– sparkzbarcaSo it should be rigidbody.AddForce(transform.forward * speed);? And the blue line is to the left for the front of the car, can it be fixed in Unity, or should I rotate it in Blender? :-)
– AndreasX12in blender yep your applying force left but its not enough force to overcome the resistnace of the wheels against the ground.
– sparkzbarca