Game Development Community

Dissecting CastRay... what is the variable 't' in RayInfo for?

by Kuju Manila · in Torque Game Engine · 05/30/2007 (8:16 pm) · 1 replies

I'm dissecting CastRay due to the fact I'm dealing with a problem stated here:
http://www.garagegames.com/mg/forums/result.thread.php?qt=62688

While checking the code of SceneObject's CastRay, I often see the variables currentT which holds a fixed magic number of 2.0f, and the other is the F32 t variable of RayInfo. What exactly do these variables mean? What's the magic number 2.0f for?

#1
05/31/2007 (5:08 am)
I think rayInfo.t represents the distance along the line between the start and end points of your cast ray when the collision occurs. I beleive it is in the range [0..1]

As for currentT, no idea :)