فهرست منبع

Added restiction of lin/ang movement for rigid bodies.

enn0x 14 سال پیش
والد
کامیت
8841b1d80a
2فایلهای تغییر یافته به همراه26 افزوده شده و 0 حذف شده
  1. 22 0
      panda/src/bullet/bulletRigidBodyNode.cxx
  2. 4 0
      panda/src/bullet/bulletRigidBodyNode.h

+ 22 - 0
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));
+}
+

+ 4 - 0
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;