[Closed] Cast ray through face and return object
I’m trying to figure out how to fire a ray out of an objects face and return the first other object it hits.
Any help much appreciated… thanks
The Avguard extension to MAXScript has a method to fire a ray into the scene and return all objects it hits. (The extension will be included in Max 2008, for 9 and earlier you would have to download it from www.scriptspot.com).
Otherwise, you would have to loop through all scene objects, shoot a ray at each one and find out which hits were valid and which one was closest.
See intersectRay() and intersectRayEx() methods in the MAXScript Reference.
Also see the “How to…Move Objects to a Surface” tutorial in the MAXScript Reference.
Thanks for the help, I’m going with the AVguard extension method, good to hear these are being included in the base package in future.