aboutsummaryrefslogtreecommitdiff
path: root/src/poser.c
diff options
context:
space:
mode:
authordpeter99 <dpeter99@gmail.com>2018-03-28 17:36:09 +0200
committerdpeter99 <dpeter99@gmail.com>2018-03-28 17:36:09 +0200
commit6f7759314baf66f69fa7a335a1f17c65e90661f2 (patch)
tree11a0e499a0ea83a5b7aa645ba05e5a87f6cc5070 /src/poser.c
parentef18541ac2e1e97de9f04f132ac7b2b1ba21e515 (diff)
parent4c373617220aca69a4acb7a32c12457a057f4e48 (diff)
downloadlibsurvive-6f7759314baf66f69fa7a335a1f17c65e90661f2.tar.gz
libsurvive-6f7759314baf66f69fa7a335a1f17c65e90661f2.tar.bz2
Merge branch 'master' of https://github.com/dpeter99/libsurvive
Diffstat (limited to 'src/poser.c')
-rw-r--r--src/poser.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/poser.c b/src/poser.c
index 1c638f8..9a0de24 100644
--- a/src/poser.c
+++ b/src/poser.c
@@ -1,6 +1,7 @@
#include "math.h"
#include <linmath.h>
#include <stdint.h>
+#include <stdio.h>
#include <survive.h>
#define _USE_MATH_DEFINES // for C
@@ -21,6 +22,12 @@ void PoserData_lighthouse_pose_func(PoserData *poser_data, SurviveObject *so, ui
} else {
const FLT up[3] = {0, 0, 1};
+ if (quatmagnitude(lighthouse_pose->Rot) == 0) {
+ SurviveContext *ctx = so->ctx;
+ SV_INFO("Pose func called with invalid pose.");
+ return;
+ }
+
// Assume that the space solved for is valid but completely arbitrary. We are going to do a few things:
// a) Using the gyro data, normalize it so that gravity is pushing straight down along Z
// c) Assume the object is at origin