Browse Source

Exposing btWheelInfo::RaycastInfo.

enn0x 14 years ago
parent
commit
1d5b7d4c55

+ 5 - 1
dtool/src/parser-inc/btBulletDynamicsCommon.h

@@ -75,7 +75,11 @@ class btTypedConstraint;
 class btTypedObject;
 class btTypedObject;
 class btVector3;
 class btVector3;
 class btVehicleRaycaster;
 class btVehicleRaycaster;
-class btWheelInfo;
+
+class btWheelInfo {
+public:
+  class RaycastInfo;
+};
 
 
 class btCollisionWorld {
 class btCollisionWorld {
 public:
 public:

+ 98 - 0
panda/src/bullet/bulletWheel.I

@@ -22,6 +22,16 @@ INLINE BulletWheel::
 
 
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: BulletWheelRaycastInfo::Destructor
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE BulletWheelRaycastInfo::
+~BulletWheelRaycastInfo() {
+
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletWheel::empty
 //     Function: BulletWheel::empty
 //       Access: Public
 //       Access: Public
@@ -37,3 +47,91 @@ empty() {
   return BulletWheel(info);
   return BulletWheel(info);
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: BulletWheelRaycastInfo::is_in_contact
+//       Access: Public
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE bool BulletWheelRaycastInfo::
+is_in_contact() const {
+
+  return _info.m_isInContact;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: BulletWheelRaycastInfo::get_suspension_length
+//       Access: Public
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE PN_stdfloat BulletWheelRaycastInfo::
+get_suspension_length() const {
+
+  return _info.m_suspensionLength;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: BulletWheelRaycastInfo::get_contact_point_ws
+//       Access: Public
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE LPoint3 BulletWheelRaycastInfo::
+get_contact_point_ws() const {
+
+  return btVector3_to_LPoint3(_info.m_contactPointWS);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: BulletWheelRaycastInfo::get_hard_point_ws
+//       Access: Public
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE LPoint3 BulletWheelRaycastInfo::
+get_hard_point_ws() const {
+
+  return btVector3_to_LPoint3(_info.m_hardPointWS);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: BulletWheelRaycastInfo::get_contact_normal_ws
+//       Access: Public
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE LVector3 BulletWheelRaycastInfo::
+get_contact_normal_ws() const {
+
+  return btVector3_to_LVector3(_info.m_contactNormalWS);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: BulletWheelRaycastInfo::get_wheel_direction_ws
+//       Access: Public
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE LVector3 BulletWheelRaycastInfo::
+get_wheel_direction_ws() const {
+
+  return btVector3_to_LVector3(_info.m_wheelDirectionWS);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: BulletWheelRaycastInfo::get_wheel_axle_ws
+//       Access: Public
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE LVector3 BulletWheelRaycastInfo::
+get_wheel_axle_ws() const {
+
+  return btVector3_to_LVector3(_info.m_wheelAxleWS);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: BulletWheelRaycastInfo::get_ground_object
+//       Access: Public
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE PandaNode *BulletWheelRaycastInfo::
+get_ground_object() const {
+
+  return _info.m_groundObject ? (PandaNode *)_info.m_groundObject : NULL;
+}
+

+ 21 - 0
panda/src/bullet/bulletWheel.cxx

@@ -24,6 +24,27 @@ BulletWheel(btWheelInfo &info) : _info(info) {
 
 
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: BulletWheelRaycastInfo::Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+BulletWheelRaycastInfo::
+BulletWheelRaycastInfo(btWheelInfo::RaycastInfo &info) : _info(info) {
+
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: BulletWheel::get_raycast_info
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+BulletWheelRaycastInfo BulletWheel::
+get_raycast_info() const {
+
+  return BulletWheelRaycastInfo(_info.m_raycastInfo);
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletWheel::get_suspension_rest_length
 //     Function: BulletWheel::get_suspension_rest_length
 //       Access: Published
 //       Access: Published

+ 26 - 0
panda/src/bullet/bulletWheel.h

@@ -23,6 +23,31 @@
 #include "luse.h"
 #include "luse.h"
 #include "pandaNode.h"
 #include "pandaNode.h"
 
 
+////////////////////////////////////////////////////////////////////
+//       Class : BulletWheelRaycastInfo
+// Description : 
+////////////////////////////////////////////////////////////////////
+class EXPCL_PANDABULLET BulletWheelRaycastInfo {
+
+PUBLISHED:
+  INLINE ~BulletWheelRaycastInfo();
+
+  INLINE bool is_in_contact() const;
+  INLINE PN_stdfloat get_suspension_length() const;
+  INLINE LVector3 get_contact_normal_ws() const;
+  INLINE LVector3 get_wheel_direction_ws() const;
+  INLINE LVector3 get_wheel_axle_ws() const;
+  INLINE LPoint3 get_contact_point_ws() const;
+  INLINE LPoint3 get_hard_point_ws() const;
+  INLINE PandaNode *get_ground_object() const;
+
+public:
+  BulletWheelRaycastInfo(btWheelInfo::RaycastInfo &info);
+
+private:
+  btWheelInfo::RaycastInfo &_info;
+};
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //       Class : BulletWheel
 //       Class : BulletWheel
 // Description : One wheel of a BulletVehicle. Instances should not
 // Description : One wheel of a BulletVehicle. Instances should not
@@ -82,6 +107,7 @@ PUBLISHED:
   LMatrix4 get_world_transform() const;
   LMatrix4 get_world_transform() const;
   bool is_front_wheel() const;
   bool is_front_wheel() const;
   PandaNode *get_node() const;
   PandaNode *get_node() const;
+  BulletWheelRaycastInfo get_raycast_info() const;
 
 
 public:
 public:
   BulletWheel(btWheelInfo &info);
   BulletWheel(btWheelInfo &info);