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

Method addLink

Engine/source/navigation/navMesh.cpp:399–427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

397}
398
399S32 NavMesh::addLink(const Point3F &from, const Point3F &to, U32 flags)
400{
401 Point3F rcFrom = DTStoRC(from), rcTo = DTStoRC(to);
402 mLinkVerts.push_back(rcFrom.x);
403 mLinkVerts.push_back(rcFrom.y);
404 mLinkVerts.push_back(rcFrom.z);
405 mLinkVerts.push_back(rcTo.x);
406 mLinkVerts.push_back(rcTo.y);
407 mLinkVerts.push_back(rcTo.z);
408 mLinksUnsynced.push_back(true);
409 mLinkRads.push_back(mWalkableRadius);
410 mLinkDirs.push_back(0);
411 mLinkAreas.push_back(OffMeshArea);
412 if (flags == 0) {
413 Point3F dir = to - from;
414 F32 drop = -dir.z;
415 dir.z = 0;
416 // If we drop more than we travel horizontally, we're a drop link.
417 if(drop > dir.len())
418 mLinkFlags.push_back(DropFlag);
419 else
420 mLinkFlags.push_back(JumpFlag);
421 }
422 mLinkIDs.push_back(1000 + mCurLinkID);
423 mLinkSelectStates.push_back(Unselected);
424 mDeleteLinks.push_back(false);
425 mCurLinkID++;
426 return mLinkIDs.size() - 1;
427}
428
429DefineEngineMethod(NavMesh, addLink, S32, (Point3F from, Point3F to, U32 flags), (0),
430 "Add a link to this NavMesh between two points.\n\n"

Callers 2

navMesh.cppFile · 0.80
on3DMouseDownMethod · 0.80

Calls 4

DTStoRCFunction · 0.85
push_backMethod · 0.45
lenMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected