- Home /
RaycastHit.distance
Hi, I'm wondering if RaycastHit.distance is the percentage the ray traveled (like a hitDelta) or if it's the number of units it travelled.
I'm trying to do some fake gravity for something cheaper than using rigid body (several hundred at once and they only need to move straight down) so when it hits something I need to only move it by the percentage the ray failed by and I'm not sure if I should divide RaycastHit.distance by total distance to get the percentage traveled, Thanks.
Answer by Bunny83 · Jan 15, 2011 at 12:53 AM
It's the distance between your ray start point and the hit point in worldunits. It's the same as:
(RaycastHit.point - RayStartPoint).magnitude
ahh, damn :D my bad. I just had too much array these days
Your answer
Follow this Question
Related Questions
default cylinder to indicate hit.normal 1 Answer
Getting a point on ray 1 Answer
Detect Object that are hit by a ray 3 Answers
Need Help with RayCast. No Vector? 1 Answer
Help With RayCasting 1 Answer