From 0a720a2259aa7b10475854964ebf74900456d229 Mon Sep 17 00:00:00 2001 From: nathansmithsmith Date: Mon, 31 Jul 2023 19:36:10 -0600 Subject: Sergente stuff working --- src/entity.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/entity.c') diff --git a/src/entity.c b/src/entity.c index fa610d0..4136463 100644 --- a/src/entity.c +++ b/src/entity.c @@ -460,10 +460,12 @@ void entityFlyToPoint(Entity * entity, Vector3 point, EntityFlyToPointInfo * inf Quaternion rotation = QuaternionInvert(QuaternionFromMatrix(matrix)); // Rotate this fucker. - if (info->rotationSpeed == 0.0) - entity->rotation = rotation; - else - entity->rotation = QuaternionSlerp(entity->rotation, rotation, t * info->rotationSpeed); + if (info->applyRotation) { + if (info->rotationSpeed == 0.0) + entity->rotation = rotation; + else + entity->rotation = QuaternionSlerp(entity->rotation, rotation, t * info->rotationSpeed); + } // Velocity control. float speed = 0.0; @@ -485,7 +487,12 @@ void entityFlyToPoint(Entity * entity, Vector3 point, EntityFlyToPointInfo * inf break; } - Matrix m = QuaternionToMatrix(QuaternionInvert(entity->rotation)); + Matrix m; + + if (info->applyRotation) + m = QuaternionToMatrix(QuaternionInvert(entity->rotation)); + else + m = matrix; // Accelerate. if (entity->useAcceleration) -- cgit v1.2.3