Hi, I’m wondering if anyone has any idea how to have a vehicle move only along the x axis in 3D space, even when hitting a bump the front of the car doesn’t move off to the left or right, it stays perfectly straight.
Example: Ultra4x4 off-road racing ULTRA4 Offroad Racing on the App Store
If anyone could help, that’d be great.
Have you tried using the Constraints option in the Rigidbody component, check the Freeze X position and Freeze Y Rotation
2 Likes
^ what he said, or you can do it with the code
gameObject.GetComponent<RigidBody>().constraints = RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezeRotationY;
Hope this helps ![]()
Thank you so much dude!
You can do the same thing in editor, no need to code that.