From 93db3d7ba6a5cda415ce738e1b1c8014a9d6c625 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Tue, 2 Aug 2016 09:30:33 -0700 Subject: [PATCH] fix CMD_INIT_POSE+INIT_POSE_HAS_INITIAL_ORIENTATION, setWorldToBaseRot takes inverse orientation (need to remove that API!) --- examples/SharedMemory/PhysicsServerCommandProcessor.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp index 469c178f8..8a54ba184 100644 --- a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp +++ b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp @@ -1836,11 +1836,12 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm clientCmd.m_initPoseArgs.m_hasInitialStateQ[6]); mb->setBaseOmega(btVector3(0,0,0)); - mb->setWorldToBaseRot(btQuaternion( - clientCmd.m_initPoseArgs.m_initialStateQ[3], + btQuaternion invOrn(clientCmd.m_initPoseArgs.m_initialStateQ[3], clientCmd.m_initPoseArgs.m_initialStateQ[4], clientCmd.m_initPoseArgs.m_initialStateQ[5], - clientCmd.m_initPoseArgs.m_initialStateQ[6])); + clientCmd.m_initPoseArgs.m_initialStateQ[6]); + + mb->setWorldToBaseRot(invOrn.inverse()); } if (clientCmd.m_updateFlags & INIT_POSE_HAS_JOINT_STATE) {