- Home /
Rigidbody car physics....
I'm making an iphone game and in it I have a car that can be driven.
It uses a box collider for the body, and a rigidbody which is pushed around with the AddForce function. I'm not using wheel rigidbodies or anything fancy, in order to keep things optimized.
The only issue I'm having is when the car collides with anything. When it smacks into a hard surface, it often slides left or right (the same way a normal rigidbody would shift around after a collision).
What I want to do is make it so that it can only move forwards/backwards in a given direction. That way I give it the effect of rolling on its wheels, which would not allow it to move in a sideways direction.
Is there any way to do this?
Answer by sneftel · Aug 16, 2011 at 07:30 PM
You can use a ConfigurableJoint to lock its local x-axis motion.
Your answer
![](https://koobas.hobune.stream/wayback/20220612182156im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
need tutorials for rigidbody.Addforce 1 Answer
Car - WheelCollider - Why the side is getting up? 2 Answers
Simple Car Script - Physics makes it wierd 1 Answer
Character Rides In Vehicle 1 Answer