aboutsummaryrefslogtreecommitdiff
path: root/src/poser.c
diff options
context:
space:
mode:
authordpeter99 <dpeter99@gmail.com>2018-03-26 22:05:21 +0200
committerGitHub <noreply@github.com>2018-03-26 22:05:21 +0200
commit4c373617220aca69a4acb7a32c12457a057f4e48 (patch)
tree6598f0185c010dc3d48067060a6303d9e58ce74f /src/poser.c
parentd106e045d8a145ceb733075e541f6aaaee5bd3a7 (diff)
parent18e717642be3af3b9f72b630dcad68ca17c32dc9 (diff)
downloadlibsurvive-4c373617220aca69a4acb7a32c12457a057f4e48.tar.gz
libsurvive-4c373617220aca69a4acb7a32c12457a057f4e48.tar.bz2
Merge branch 'master' into master
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