Game Development Community

When the crosshair hovers over a target, object selection

by lineage · in Torque Game Engine · 07/14/2005 (9:10 pm) · 5 replies

I was wondering how to get object selection or detection once the crosshair hovers over a target. then afterwards, do something to the object (apply force, fire, etc)

i know the guiShapeNameHud pops up with the health bar, but i can't find exactly where its called to do taht when the crosshair goes over a player. but im guessing this is definitely a good example of what im trying to do. i feel like its right under my nose. if anyone could point it out thatd be great. thanks


dennis

#1
07/14/2005 (10:06 pm)
I think the simplest solution would be to use the Object Selection for Torque v1.2 and above tutorial, then instead of togglemouselook or whatever in the default.bind.cs file, bind the CommandToServer, that shows up near the bottom of the resource, in the playgui.cs file IIRC.

Haven't tried it myself, but it should work.
#2
07/14/2005 (10:27 pm)
Well if you are wanting to apply the force or whatnot on a trigger, as opposed to as soon as the crosshair hovers, you could simply cast a ray on the muzzlevector and get the return.
#3
07/15/2005 (9:31 pm)
Thanks guys - i finally got it - i just used eye vector and eye point since i figured, the guy is running and the gun is moving around - so i didn't want to have it point based on where the gun is.

the object selection really helped out for anyone interested in doing this.
#4
07/15/2005 (10:11 pm)
Glad to help, I use that tutorial and Custom Shape Mod, dang near every day.
#5
07/08/2006 (11:40 am)
How did you use the eye vector to locate the point?