mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Recast: clamp the off-mesh connection positions as well
Allows for parsing zipline positions from BSP entity partitions and placing them whilst also having it clamp the positions correctly to the polygon the zipliner will end up or start from.
This commit is contained in:
parent
5cb0e93766
commit
fa1db8f995
@ -1015,7 +1015,7 @@ public:
|
||||
/// Builds external polygon links for a tile.
|
||||
dtStatus connectOffMeshLinks(const dtTileRef tileRef);
|
||||
|
||||
dtPolyRef clampOffMeshVertToPoly(const dtOffMeshConnection* con, dtMeshTile* conTile, const dtMeshTile* lookupTile, const bool start);
|
||||
dtPolyRef clampOffMeshVertToPoly(dtOffMeshConnection* con, dtMeshTile* conTile, const dtMeshTile* lookupTile, const bool start);
|
||||
|
||||
private:
|
||||
/// Returns all polygons in neighbour tile based on portal defined by the segment.
|
||||
|
@ -531,7 +531,7 @@ void dtNavMesh::connectExtLinks(dtMeshTile* tile, dtMeshTile* target, int side)
|
||||
}
|
||||
}
|
||||
|
||||
dtPolyRef dtNavMesh::clampOffMeshVertToPoly(const dtOffMeshConnection* con, dtMeshTile* conTile,
|
||||
dtPolyRef dtNavMesh::clampOffMeshVertToPoly(dtOffMeshConnection* con, dtMeshTile* conTile,
|
||||
const dtMeshTile* lookupTile, const bool start)
|
||||
{
|
||||
const float* p = start ? &con->pos[0] : &con->pos[3];
|
||||
@ -548,8 +548,12 @@ dtPolyRef dtNavMesh::clampOffMeshVertToPoly(const dtOffMeshConnection* con, dtMe
|
||||
const dtPoly* poly = &conTile->polys[con->poly];
|
||||
|
||||
// Make sure the location is on current mesh.
|
||||
float* v = &conTile->verts[poly->verts[start?0:1]*3];
|
||||
rdVcopy(v, nearestPt);
|
||||
float* polyVert = &conTile->verts[poly->verts[start?0:1]*3];
|
||||
rdVcopy(polyVert, nearestPt);
|
||||
|
||||
// Update the off-mesh connection positions as well.
|
||||
float* conPos = &con->pos[start?0:3];
|
||||
rdVcopy(conPos, nearestPt);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user