MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / on3DMouseDown

Method on3DMouseDown

Engine/source/navigation/guiNavEditorCtrl.cpp:292–398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290}
291
292void GuiNavEditorCtrl::on3DMouseDown(const Gui3DMouseEvent & event)
293{
294 mGizmo->on3DMouseDown(event);
295
296 if(!isFirstResponder())
297 setFirstResponder();
298
299 mouseLock();
300
301 // Construct a LineSegment from the camera position to 1000 meters away in
302 // the direction clicked.
303 // If that segment hits the terrain, truncate the ray to only be that length.
304
305 Point3F startPnt = event.pos;
306 Point3F endPnt = event.pos + event.vec * 1000.0f;
307
308 RayInfo ri;
309
310 U8 keys = Input::getModifierKeys();
311 bool shift = keys & SI_LSHIFT;
312 bool ctrl = keys & SI_LCTRL;
313
314 if(mMode == mLinkMode && !mMesh.isNull())
315 {
316 if(gServerContainer.castRay(startPnt, endPnt, StaticObjectType, &ri))
317 {
318 U32 link = mMesh->getLink(ri.point);
319 if(link != -1)
320 {
321 if(mLink != -1)
322 mMesh->selectLink(mLink, false);
323 mMesh->selectLink(link, true, false);
324 mLink = link;
325 LinkData d = mMesh->getLinkFlags(mLink);
326 Con::executef(this, "onLinkSelected", Con::getIntArg(d.getFlags()));
327 }
328 else
329 {
330 if(mLink != -1)
331 {
332 mMesh->selectLink(mLink, false);
333 mLink = -1;
334 Con::executef(this, "onLinkDeselected");
335 }
336 else
337 {
338 if(mLinkStart != Point3F::Max)
339 {
340 mMesh->addLink(mLinkStart, ri.point);
341 if(!shift)
342 mLinkStart = Point3F::Max;
343 }
344 else
345 {
346 mLinkStart = ri.point;
347 }
348 }
349 }

Callers

nothing calls this directly

Calls 13

executefFunction · 0.85
getIntArgFunction · 0.85
getLinkMethod · 0.80
selectLinkMethod · 0.80
getLinkFlagsMethod · 0.80
addLinkMethod · 0.80
renderTileDataMethod · 0.80
setPathDestinationMethod · 0.80
isNullMethod · 0.45
castRayMethod · 0.45
getFlagsMethod · 0.45
getTileMethod · 0.45

Tested by

no test coverage detected