From aa750f4046755632678300d3f6d55636fcd4aac1 Mon Sep 17 00:00:00 2001 From: David Staer Date: Thu, 29 Nov 2018 23:02:40 +0800 Subject: [PATCH] Fix BulletCapsuleShape creation from Panda CollisionTube Functions get_point_a() and get_point_b() appear to return the top of the cylinder section of the tube, not the tip of the endcap, making subtracting the radius unnecessary. --- panda/src/bullet/bulletCapsuleShape.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/panda/src/bullet/bulletCapsuleShape.cxx b/panda/src/bullet/bulletCapsuleShape.cxx index 8ff2b3e37a..0bdb1284dc 100644 --- a/panda/src/bullet/bulletCapsuleShape.cxx +++ b/panda/src/bullet/bulletCapsuleShape.cxx @@ -93,8 +93,8 @@ BulletCapsuleShape *BulletCapsuleShape:: make_from_solid(const CollisionTube *solid) { PN_stdfloat radius = solid->get_radius(); - // CollisionTube height includes the hemispheres, Bullet only wants the cylinder height. - PN_stdfloat height = (solid->get_point_b() - solid->get_point_a()).length() - (radius * 2); + // Get tube's cylinder height: length from point A to point B + PN_stdfloat height = (solid->get_point_b() - solid->get_point_a()).length(); // CollisionTubes are always Z-Up. return new BulletCapsuleShape(radius, height, Z_up);