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

Method addLink

Engine/source/navigation/navMesh.cpp:403–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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