Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion maths
Submodule maths updated 1 files
+28 −0 sm/scale
12 changes: 10 additions & 2 deletions mplot/NavMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ namespace mplot
*/
sm::vec<float> tn0 = {};

/*!
* Stabilisation flag: if true, no rotation is applied when moving over a triangle boundary
* in NavMesh::compute_mesh_movement. If false, then a rotation about the triangle boundary
* is made.
*/
bool stabilised = false;

/*!
* Return index of this->vertex that is closest to scene_coord. Can use vertexidx_to_indices
* to find the indices into vertexPositions and vertexNormals that this index in the
Expand Down Expand Up @@ -1297,8 +1304,9 @@ namespace mplot
if (flags.test (cmm_fl::vertex_crossing)) { cd.tri_edge = this->tn0.cross (_tn); }

// Compute the reorientation due to the requested movement.
// Rotate by the angle between the normals. I think this is constrained to be <= pi
float rotn_angle = this->tn0.angle (_tn, cd.tri_edge);
float rotn_angle = 0.0f;
// Rotate by the angle between the normals (if stabilised is false). I think this is constrained to be <= pi
if (stabilised == false) { this->tn0.angle (_tn, cd.tri_edge); }
// If tn0 and _tn are identical, then rotn_angle will be NaN, but in that case we want no rotation
if (std::isnan (rotn_angle)) { rotn_angle = 0.0f; }
sm::mat44<float> reorient_model; // reorientation transformation in sf
Expand Down
Loading