Unprojecting a mouse and ray casting
by James Terry · in Torque Game Engine · 12/04/2006 (1:38 pm) · 6 replies
I currently have my game set up to use ShapeBase.cc's castRay function to return the object name that it hits first. I was building the parameters to send to it by figuring the x/y positions of each corner of the square I am interacting with in mouse positions, then converting it to world dimensions (which I don't think is working too well)
Is there a way for me to, with a static view of my world, unproject the mouse x/y into world coordinates and then send a rayCast out, I keep getting erroneous data for which object is being hit.
Is there a way for me to, with a static view of my world, unproject the mouse x/y into world coordinates and then send a rayCast out, I keep getting erroneous data for which object is being hit.
#2
12/04/2006 (2:26 pm)
Do you know of a way to convert T2D's onMousedown %worldPosition into the GuiEvent that GameTSCtrl uses. Last time I tried that resource it would give me the same unproject no matter where I clicked on the screen and wasn't too much use.
#3
try reading the whole thing.
there's a lot of good advice in it around how to get it working.
12/04/2006 (3:35 pm)
Pretty sure the object selection resource works..try reading the whole thing.
there's a lot of good advice in it around how to get it working.
#4
Thanks for the reccomendation
12/04/2006 (4:03 pm)
I'll work on it first thing in the morning. I may have been mistaking it for a different resource I tried. Skimming through the code it seems like just what I need.Thanks for the reccomendation
#5
I have one small issue though. I am rotating some of my objects and ContainerRayCast is returning when it hits a bounding box of one of these rotated objects instead of returning when it hits the collision mesh, is there an easy way to change this functionality?
12/05/2006 (10:53 am)
Alright, its all in and working :)I have one small issue though. I am rotating some of my objects and ContainerRayCast is returning when it hits a bounding box of one of these rotated objects instead of returning when it hits the collision mesh, is there an easy way to change this functionality?
#6
try posting the question to the object selection resource - maybe someone who knows the answer is watching the thread.
12/05/2006 (10:55 am)
Hmm, good Q. i'm not sure.try posting the question to the object selection resource - maybe someone who knows the answer is watching the thread.
Associate Orion Elenzil
Real Life Plus
the one titled "v.12 onward".