aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Turvey <mturvey6@gmail.com>2017-05-31 10:04:21 -0700
committerMike Turvey <mturvey6@gmail.com>2017-05-31 10:04:21 -0700
commit5c6d30471e789b975a3eceab05d8e68dbaec0533 (patch)
tree29e04a5990895ccdf7b7a6141ead2c6af0fd718a
parent074e6894ad75345b697763dfccc632c5959b1603 (diff)
downloadlibsurvive-5c6d30471e789b975a3eceab05d8e68dbaec0533.tar.gz
libsurvive-5c6d30471e789b975a3eceab05d8e68dbaec0533.tar.bz2
Updates to rotation calculation of tracked object
-rw-r--r--src/poser_turveytori.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/poser_turveytori.c b/src/poser_turveytori.c
index e10a323..86b763b 100644
--- a/src/poser_turveytori.c
+++ b/src/poser_turveytori.c
@@ -1366,14 +1366,24 @@ static Point SolveForLighthouse(FLT posOut[3], FLT quatOut[4], TrackedObject *ob
wcPos[2] += so->ctx->bsd[lh].Pose.Pos[2];
FLT newOrientation[4];
- //quatrotateabout(newOrientation, rotQuat, so->ctx->bsd[lh].Pose.Rot);
- quatrotateabout(newOrientation, so->ctx->bsd[lh].Pose.Rot, rotQuat);
+ //quatrotateabout(newOrientation, rotQuat, so->ctx->bsd[lh].Pose.Rot); // turns the wrong way
+ //quatrotateabout(newOrientation, so->ctx->bsd[lh].Pose.Rot, rotQuat); // turns the wrong way
+
+ FLT invRot[4];
+ quatgetreciprocal(invRot, rotQuat);
+ //quatrotateabout(newOrientation, invRot, so->ctx->bsd[lh].Pose.Rot); // turns correctly, rotations not aligned
+ //quatrotateabout(newOrientation, so->ctx->bsd[lh].Pose.Rot, invRot); // turns correctly, rotations not aligned
+
+ FLT invPoseRot[4];
+ quatgetreciprocal(invPoseRot, so->ctx->bsd[lh].Pose.Rot);
+
+ //quatrotateabout(newOrientation, rotQuat, invPoseRot); // turns the wrong way, rotations not aligned
+ //quatrotateabout(newOrientation, invPoseRot, rotQuat); // turns the wrong way, rotations not aligned
//FLT invRot[4];
//quatgetreciprocal(invRot, rotQuat);
- //quatrotateabout(newOrientation, invRot, so->ctx->bsd[lh].Pose.Rot);
- ////quatrotateabout(newOrientation, so->ctx->bsd[lh].Pose.Rot, invRot);
-
+ quatrotateabout(newOrientation, invRot, invPoseRot); // turns correctly, rotations aligned <-- This seems to be the best.
+ //quatrotateabout(newOrientation, invPoseRot, invRot); // turns correctly, rotations aligned, (x & y flipped?)
so->OutPose.Pos[0] = wcPos[0];
so->OutPose.Pos[1] = wcPos[1];