From 2f90255d1a45d7b8d484a20b5dd87639a9f3ee80 Mon Sep 17 00:00:00 2001 From: bjorn Date: Fri, 28 Jul 2023 16:16:14 -0700 Subject: [PATCH] physics no longer depends on maf; So little is used, may as well make it more self-contained. --- src/modules/physics/physics.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/modules/physics/physics.c b/src/modules/physics/physics.c index 5a3138dd..9ab986ad 100644 --- a/src/modules/physics/physics.c +++ b/src/modules/physics/physics.c @@ -1,5 +1,4 @@ #include "physics.h" -#include "core/maf.h" #include "util.h" #include #include @@ -697,12 +696,15 @@ void lovrColliderSetPosition(Collider* collider, float x, float y, float z) { dBodySetPosition(collider->body, x, y, z); } -void lovrColliderGetOrientation(Collider* collider, quat orientation) { +void lovrColliderGetOrientation(Collider* collider, float* orientation) { const dReal* q = dBodyGetQuaternion(collider->body); - quat_set(orientation, q[1], q[2], q[3], q[0]); + orientation[0] = q[1]; + orientation[1] = q[2]; + orientation[2] = q[3]; + orientation[3] = q[0]; } -void lovrColliderSetOrientation(Collider* collider, quat orientation) { +void lovrColliderSetOrientation(Collider* collider, float* orientation) { dReal q[4] = { orientation[3], orientation[0], orientation[1], orientation[2] }; dBodySetQuaternion(collider->body, q); } @@ -908,13 +910,16 @@ void lovrShapeSetPosition(Shape* shape, float x, float y, float z) { dGeomSetOffsetPosition(shape->id, x, y, z); } -void lovrShapeGetOrientation(Shape* shape, quat orientation) { +void lovrShapeGetOrientation(Shape* shape, float* orientation) { dReal q[4]; dGeomGetOffsetQuaternion(shape->id, q); - quat_set(orientation, q[1], q[2], q[3], q[0]); + orientation[0] = q[1]; + orientation[1] = q[2]; + orientation[2] = q[3]; + orientation[3] = q[0]; } -void lovrShapeSetOrientation(Shape* shape, quat orientation) { +void lovrShapeSetOrientation(Shape* shape, float* orientation) { dReal q[4] = { orientation[3], orientation[0], orientation[1], orientation[2] }; dGeomSetOffsetQuaternion(shape->id, q); }