Game Development Community

SetSelectedObject not UNselecting

by Jonathon Stevens · in Torque Game Engine · 02/10/2006 (12:12 am) · 3 replies

I'm using some object selection code (do a search for setSelectedObject and you'll come up with it) and it puts a greenish circle around the selected object/player. What I want to do is REMOVE this if the player clicks on a non-selectable item such as the ground or a building. Any thoughts?

About the author

With a few casual games under his belt as CEO of Last Straw Productions, Jonathon created the increasingly popular Indie MMO Game Developers Conference.


#1
02/10/2006 (12:40 am)
I haven't even looked at that resource before, but at a quick glance it's obvious that you can just put an else, and clear the selection....?

// a target in range was found so select it   
if (%scanTarg)   
{      
    %targetObject = firstWord(%scanTarg);      
    %client.setSelectedObject(%targetObject);   
}
#2
02/10/2006 (12:48 am)
Or possibly append to that:
// a target in range was found so select it   
if (%scanTarg)   
{      
    %targetObject = firstWord(%scanTarg);
    %client.setSelectedObject(%targetObject);
}
else
{
    %client.setSelectedObject(0);
}
#3
02/10/2006 (7:59 am)
When I skimmed over the C++ function setSelectedObject, I didn't think at first look that you could pass anything but a valid selectable item/player in. I'll look again when I get home.