| 397 | } |
| 398 | |
| 399 | S32 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 | |
| 429 | DefineEngineMethod(NavMesh, addLink, S32, (Point3F from, Point3F to, U32 flags), (0), |
| 430 | "Add a link to this NavMesh between two points.\n\n" |
no test coverage detected