How can i stop the car penetrating into the terrain

simply iam having one car model and try to move this using c# scripts.
that code contain gets input from keyboard and move the car…its contains transform.rotate and transform.translate functions only…but my car model penetrating into the terrain(mountain).i,e whenever the camera Z angle gets negative value the car penetrate into the terrain…could anyone help me to stop the penetration and give me the suggestion for car moving in ups and downs…Thank u

I’ll give a shot at answering this question, but if I get it wrong, please add images of your scene and add your code, which would give us better insight of the situation.

One thing you should know is that doing a transform.translate sets the position in smooth lerps. However it can ignore the collision too.

First of all, for collisions you’ll need a rigidbody on the Car object. Once you have a rigidbody, try using rigidbody.AddForce(); to move the car about, there are plenty of tutorials on this, so you should be fine :slight_smile:

So maybe that’s enough to solve your problem.
But if it isn’t, please add some scene images and code so we can give more accurate answers :slight_smile:
Best of luck! :wink: