diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-08-09 23:20:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-09 23:20:44 +0200 |
commit | 2de5d2361ac39e61c610d6fc0f161a1237ae2815 (patch) | |
tree | 393cad3673fe40a5291c7c5e458e5935b977d8a5 /modules/bullet | |
parent | 7bcfc66fb4253fb121008809e4e81c5b704776b7 (diff) | |
parent | 5650c83e4b7f669066685a9f5526d7ec56e9b43d (diff) |
Merge pull request #51446 from nekomatata/fix-moving-platform-rotation
Fix applied rotation from moving platforms in move_and_slide
Diffstat (limited to 'modules/bullet')
-rw-r--r-- | modules/bullet/rigid_body_bullet.cpp | 10 | ||||
-rw-r--r-- | modules/bullet/rigid_body_bullet.h | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp index ce39d4f0df..0d2cd1f5a0 100644 --- a/modules/bullet/rigid_body_bullet.cpp +++ b/modules/bullet/rigid_body_bullet.cpp @@ -114,6 +114,16 @@ Transform3D BulletPhysicsDirectBodyState3D::get_transform() const { return body->get_transform(); } +Vector3 BulletPhysicsDirectBodyState3D::get_velocity_at_local_position(const Vector3 &p_position) const { + btVector3 local_position; + G_TO_B(p_position, local_position); + + Vector3 velocity; + B_TO_G(body->btBody->getVelocityInLocalPoint(local_position), velocity); + + return velocity; +} + void BulletPhysicsDirectBodyState3D::add_central_force(const Vector3 &p_force) { body->apply_central_force(p_force); } diff --git a/modules/bullet/rigid_body_bullet.h b/modules/bullet/rigid_body_bullet.h index 606df7134b..5e102d8b05 100644 --- a/modules/bullet/rigid_body_bullet.h +++ b/modules/bullet/rigid_body_bullet.h @@ -110,6 +110,8 @@ public: virtual void set_transform(const Transform3D &p_transform) override; virtual Transform3D get_transform() const override; + virtual Vector3 get_velocity_at_local_position(const Vector3 &p_position) const override; + virtual void add_central_force(const Vector3 &p_force) override; virtual void add_force(const Vector3 &p_force, const Vector3 &p_position = Vector3()) override; virtual void add_torque(const Vector3 &p_torque) override; |