diff --git a/maths b/maths index 534fc8a0..90f1c5f6 160000 --- a/maths +++ b/maths @@ -1 +1 @@ -Subproject commit 534fc8a07ab12374c0befcf280878f265b3b0203 +Subproject commit 90f1c5f6a85af3099b8c5521e2a171525e29a789 diff --git a/mplot/NavMesh.h b/mplot/NavMesh.h index 33951c78..8ee81e9e 100644 --- a/mplot/NavMesh.h +++ b/mplot/NavMesh.h @@ -114,6 +114,13 @@ namespace mplot */ sm::vec 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 @@ -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 reorient_model; // reorientation transformation in sf