From 468ddb3528406c1e58884454d1be797ba2133743 Mon Sep 17 00:00:00 2001 From: enn0x Date: Wed, 1 May 2013 21:15:43 +0000 Subject: [PATCH] Fix which allows setting scale on a Bullet rigid body before any shape is added. --- panda/src/bullet/bulletBodyNode.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/panda/src/bullet/bulletBodyNode.cxx b/panda/src/bullet/bulletBodyNode.cxx index 8839a38699..f7985e12bc 100644 --- a/panda/src/bullet/bulletBodyNode.cxx +++ b/panda/src/bullet/bulletBodyNode.cxx @@ -178,6 +178,12 @@ add_shape(BulletShape *shape, CPT(TransformState) ts) { trans = TransformState_to_btTrans(ts); } + // Reset the shape scaling before we add a shape, and remember the current + // Scale so we can restore it later... + NodePath np = NodePath::any_path((PandaNode *)this); + LVector3 scale = np.get_scale(); + np.set_scale(1.0); + // Root shape btCollisionShape *previous = get_object()->getCollisionShape(); btCollisionShape *next; @@ -227,6 +233,9 @@ add_shape(BulletShape *shape, CPT(TransformState) ts) { _shapes.push_back(shape); shape_changed(); + + // Restore the local scaling again + np.set_scale(scale); } ////////////////////////////////////////////////////////////////////