Game Development Community

Castray

by Morrock · in Technical Issues · 10/11/2007 (4:35 pm) · 7 replies

So, I've been reading a bunch of things on it and how to use it but I just can't understand how to actually cast a ray. I know what they are and what they're used for, but can someone please explain to me how I call it up? Also is it possible to cast a ray at the the end of another ray, I'd like to form a T shape with it.

#1
10/12/2007 (6:23 pm)
A ray is like an invisible line that is drawn for a point u specify moving in a direction u specify, till it hits an object with the types that u specified (lots of specify :D) to be collision-able with.
its all about startpoint, direction & typeMasks (& there is an ignore object with is usually set to the player as u dont want to select ur own player in most cases)
ray casts are used to detect if there is something in this line, like what u r looking at, or like to know something about what u r aiming at like health or player name ...
#2
10/13/2007 (11:35 am)
Thanks but I already know what a ray is, I just don't know how to call one up or create it ingame. Can anyone tell me the code to create a ray?
#3
10/13/2007 (11:47 am)
Morrock, look at the funtions I mentioned in this thread, they should be helpful for you as well.
#4
10/13/2007 (12:47 pm)
Ok so I think I'm starting to get it. Though if I were to say (assuming I've given each variable a value):

%ray = ContainerRayCast(%start, %end, InteriorObjectType);

if it collides with an Interior what does it return? True, The Interior's handle, or the location it collided at? Also can I set the exclude parameter to an entire mask or 1 objects handle?
#5
10/13/2007 (12:53 pm)
Please use the search function: ContainerRayCast info.
#6
10/13/2007 (4:30 pm)
Oh, I get it all now. Thanks so much
#7
10/21/2007 (3:02 pm)
Alright, so I have a ray going from %start to %end now i want to make a new line with %end moved and %start in the same position. Can anyone tell me how I can rotate a point around another in Torquescript?