From 8841b1d80a7e327d11f5f3ff9ebc44a0f6677e1d Mon Sep 17 00:00:00 2001 From: enn0x Date: Sun, 10 Jul 2011 20:10:13 +0000 Subject: [PATCH] Added restiction of lin/ang movement for rigid bodies. --- panda/src/bullet/bulletRigidBodyNode.cxx | 22 ++++++++++++++++++++++ panda/src/bullet/bulletRigidBodyNode.h | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/panda/src/bullet/bulletRigidBodyNode.cxx b/panda/src/bullet/bulletRigidBodyNode.cxx index 49e815831f..6f46478f09 100644 --- a/panda/src/bullet/bulletRigidBodyNode.cxx +++ b/panda/src/bullet/bulletRigidBodyNode.cxx @@ -416,3 +416,25 @@ get_gravity() const { return btVector3_to_LVector3f(_body->getGravity()); } +//////////////////////////////////////////////////////////////////// +// Function: BulletRigidBodyNode::set_linear_factor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletRigidBodyNode:: +set_linear_factor(const LVector3f &factor) { + + _body->setLinearFactor(LVecBase3f_to_btVector3(factor)); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletRigidBodyNode::set_angular_factor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletRigidBodyNode:: +set_angular_factor(const LVector3f &factor) { + + _body->setAngularFactor(LVecBase3f_to_btVector3(factor)); +} + diff --git a/panda/src/bullet/bulletRigidBodyNode.h b/panda/src/bullet/bulletRigidBodyNode.h index 91ea7d0106..4375035eeb 100644 --- a/panda/src/bullet/bulletRigidBodyNode.h +++ b/panda/src/bullet/bulletRigidBodyNode.h @@ -73,6 +73,10 @@ PUBLISHED: void set_gravity(const LVector3f &gravity); LVector3f get_gravity() const; + // Restrict movement + void set_linear_factor(const LVector3f &factor); + void set_angular_factor(const LVector3f &factor); + public: virtual btCollisionObject *get_object() const;