Hello everyone,
I am working on a little 2.5D car game. What I would like to do is allow the player to rotate the car when its in the air. I am having trouble figuring out how to detect if my car is on the ground (right side up or upside down) or in the air though. I have looked into collision detection and ray-casting, but am quickly getting in over my head. I am very new to this so any help would be appreciated.
Getting the car to rotate using inputs was no issue. Here is what I use for that.
var rotationSpeed = 30;
if (Input.GetKey(KeyCode.D))
transform.Rotate(Vector3.forward * rotationSpeed * Time.deltaTime);
if (Input.GetKey(KeyCode.A))
transform.Rotate(-Vector3.forward * rotationSpeed * Time.deltaTime);
I have also tagged the car as Player and the ground as Track if that helps.