Update: fixed! Units not always moving on r-mouse down
by Jared Barger · in RTS Starter Kit · 11/19/2004 (3:41 pm) · 3 replies
If you're giving a command to move a unit a longer distance than their vision radius and you happen to click on an enemy unit that you can't currently see then nothing happens.
In engine/game/rts/guiRTSCtrl.cc in the collide function we need to add a clause for if we click a unit but we can't see it.
Adding in the else if clause here takes care of it
In engine/game/rts/guiRTSCtrl.cc in the collide function we need to add a clause for if we click a unit but we can't see it.
Adding in the else if clause here takes care of it
if (!unit || conn->isUnitVisible(unit))
{
info.pos = ri.point;
info.obj = ri.object;
info.normal = ri.normal;
//info.start = event.pos;
AssertFatal(info.obj, "GuiSquadTSCtrl::collide - client container returned non SceneObject");
AssertFatal(info.obj->isClientObject(), "Non server object!");
}
// new
else if(unit && !conn->isUnitVisible(unit)){
hit = gClientContainer.castRay(startPnt, endPnt, TerrainObjectType | StaticShapeObjectType, &ri);
if(hit){
info.pos = ri.point;
info.obj = ri.object;
info.normal = ri.normal;
//info.start = event.pos;
AssertFatal(info.obj, "GuiSquadTSCtrl::collide - client container returned non SceneObject");
AssertFatal(info.obj->isClientObject(), "Non server object!");
}//if
}//else if
// end new
else
hit = false;About the author
Torque 3D Owner Stephen Zepp