diff options
author | Justin Berger <j.david.berger@gmail.com> | 2018-03-25 21:24:19 -0600 |
---|---|---|
committer | Justin Berger <j.david.berger@gmail.com> | 2018-03-25 21:29:41 -0600 |
commit | 31c9dcb9f783e4920f675010833739f9a3783eea (patch) | |
tree | 96624dead36501215456558f3e99e810fe17c214 /src/poser.c | |
parent | 005713cf133df85f208ff0cb2117a6855b85a5a7 (diff) | |
download | libsurvive-31c9dcb9f783e4920f675010833739f9a3783eea.tar.gz libsurvive-31c9dcb9f783e4920f675010833739f9a3783eea.tar.bz2 |
Made degenerate poses call SV_ERROR
Diffstat (limited to 'src/poser.c')
-rw-r--r-- | src/poser.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/poser.c b/src/poser.c index 2cfe28d..7dcdc33 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> void PoserData_poser_raw_pose_func(PoserData *poser_data, SurviveObject *so, uint8_t lighthouse, SurvivePose *pose) { @@ -18,6 +19,11 @@ 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_ERROR("Pose func called with invalid pose."); + } + // 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 |