diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-12-11 10:35:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-11 10:35:09 +0100 |
commit | dfb3634c3462adb3d9f0bf1e2e7b4261c3313b80 (patch) | |
tree | 5686d27865e80aab6d60abc2e8e34fc2138a38a9 /modules/bullet/collision_object_bullet.cpp | |
parent | 237be766d4b0247d7ded0a9b85da12a989c561c8 (diff) | |
parent | b546cd50a36a809ba8beb8da1126d41c3b19294b (diff) |
Merge pull request #13836 from AndreaCatania/scale
Fixed bullet scale on get_transform and joints
Diffstat (limited to 'modules/bullet/collision_object_bullet.cpp')
-rw-r--r-- | modules/bullet/collision_object_bullet.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/bullet/collision_object_bullet.cpp b/modules/bullet/collision_object_bullet.cpp index da3a4b73cf..88d4108f82 100644 --- a/modules/bullet/collision_object_bullet.cpp +++ b/modules/bullet/collision_object_bullet.cpp @@ -76,11 +76,17 @@ bool equal(real_t first, real_t second) { void CollisionObjectBullet::set_body_scale(const Vector3 &p_new_scale) { if (!equal(p_new_scale[0], body_scale[0]) || !equal(p_new_scale[1], body_scale[1]) || !equal(p_new_scale[2], body_scale[2])) { - G_TO_B(p_new_scale, body_scale); + body_scale = p_new_scale; on_body_scale_changed(); } } +btVector3 CollisionObjectBullet::get_bt_body_scale() const { + btVector3 s; + G_TO_B(body_scale, s); + return s; +} + void CollisionObjectBullet::on_body_scale_changed() { } @@ -160,6 +166,7 @@ void CollisionObjectBullet::set_transform(const Transform &p_global_transform) { Transform CollisionObjectBullet::get_transform() const { Transform t; B_TO_G(get_transform__bullet(), t); + t.basis.scale(body_scale); return t; } @@ -302,7 +309,7 @@ void RigidCollisionObjectBullet::on_shapes_changed() { } } - compoundShape->setLocalScaling(body_scale); + compoundShape->setLocalScaling(get_bt_body_scale()); compoundShape->recalculateLocalAabb(); } |