From ea1b5a99f6d6c210168daf6d68f57dc90b36e5ed Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 8 Jul 2003 01:03:49 +0000 Subject: [PATCH] don't introduce matrix errors from the pusher --- panda/src/collide/collisionHandlerPusher.cxx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/panda/src/collide/collisionHandlerPusher.cxx b/panda/src/collide/collisionHandlerPusher.cxx index 9eca9627a1..f00538d670 100644 --- a/panda/src/collide/collisionHandlerPusher.cxx +++ b/panda/src/collide/collisionHandlerPusher.cxx @@ -252,9 +252,21 @@ handle_entries() { } #endif - LMatrix4f mat; - def.get_mat(mat); - def.set_mat(LMatrix4f::translate_mat(net_shove) * mat); + if (def._node != (PandaNode *)NULL) { + // If we are adjusting a plain PandaNode, get the + // transform and adjust just the position to preserve + // maximum precision. + CPT(TransformState) trans = def._node->get_transform(); + LVecBase3f pos = trans->get_pos(); + pos += net_shove * trans->get_mat(); + def._node->set_transform(trans->set_pos(pos)); + } else { + // Otherwise, go ahead and do the matrix math to do things + // the old and clumsy way. + LMatrix4f mat; + def.get_mat(mat); + def.set_mat(LMatrix4f::translate_mat(net_shove) * mat); + } } } }