Ok, so I’m trying to do what I thought would be a simple piece of code to determine how high a player is from my racetrack. It’s simply not working. The rays only ever go to the world origin, and even when I move, they continue to point directly there. Even when I tried getting the distance of the ray, it only ever told me 0. I have the script attached to the game object I want it done with, but the ray simply moves around along behind it. [20108-screen+shot+2014-01-02+at+12.42.09+pm.png|20108]
Here is the code that is controlling the ray cast currently. Any help would be massively appreciated!
var hit : RaycastHit;
var ray : Ray;
Physics.Raycast(transform.position, -Vector3.up, hit);
Debug.Log(hit.distance);
Debug.DrawLine(transform.position, -Vector3.up, Color.red);