2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-10 10:27:42 +00:00

Pathfinding and generator fixes

This commit is contained in:
Jack Andersen
2019-01-29 22:38:16 -10:00
parent c9a38c567f
commit c3d8afa852
7 changed files with 69 additions and 71 deletions

View File

@@ -188,14 +188,14 @@ zeus::CVector3f CPFRegion::FitThroughLink2d(const zeus::CVector3f& p1, const CPF
zeus::CVector3f nodeDelta = nextNode.GetPos() - node.GetPos();
float t = 0.5f;
if (chRadius < 0.5f * link.Get2dWidth()) {
zeus::CVector2f delta2d(nodeDelta.x(), nodeDelta.y());
zeus::CVector2f delta2d = nodeDelta.toVec2f();
delta2d *= link.GetOO2dWidth();
zeus::CVector3f nodeToP1 = p1 - node.GetPos();
float f27 = nodeToP1.dot(node.GetNormal());
float f31 = delta2d.dot(zeus::CVector2f(nodeToP1.y(), nodeToP1.y()));
float f31 = delta2d.dot(nodeToP1.toVec2f());
zeus::CVector3f nodeToP2 = p2 - node.GetPos();
float f26 = -nodeToP2.dot(node.GetNormal());
float f1b = delta2d.dot(zeus::CVector2f(nodeToP2.y(), nodeToP2.y()));
float f1b = delta2d.dot(nodeToP2.toVec2f());
float f3 = f27 + f26;
if (f3 > FLT_EPSILON)
t = zeus::clamp(chRadius, 1.f / f3 * (f26 * f31 + f27 * f1b), link.Get2dWidth() - chRadius) * link.GetOO2dWidth();