diff --git a/dtool/src/parser-inc/btBulletDynamicsCommon.h b/dtool/src/parser-inc/btBulletDynamicsCommon.h index 77a0925dc1..e5553b70e5 100644 --- a/dtool/src/parser-inc/btBulletDynamicsCommon.h +++ b/dtool/src/parser-inc/btBulletDynamicsCommon.h @@ -75,7 +75,11 @@ class btTypedConstraint; class btTypedObject; class btVector3; class btVehicleRaycaster; -class btWheelInfo; + +class btWheelInfo { +public: + class RaycastInfo; +}; class btCollisionWorld { public: diff --git a/panda/src/bullet/bulletWheel.I b/panda/src/bullet/bulletWheel.I index ddba951a7c..550fe33021 100644 --- a/panda/src/bullet/bulletWheel.I +++ b/panda/src/bullet/bulletWheel.I @@ -22,6 +22,16 @@ INLINE BulletWheel:: } +//////////////////////////////////////////////////////////////////// +// Function: BulletWheelRaycastInfo::Destructor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE BulletWheelRaycastInfo:: +~BulletWheelRaycastInfo() { + +} + //////////////////////////////////////////////////////////////////// // Function: BulletWheel::empty // Access: Public @@ -37,3 +47,91 @@ empty() { 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; +} + diff --git a/panda/src/bullet/bulletWheel.cxx b/panda/src/bullet/bulletWheel.cxx index 0a3ba7e7c3..7be7f96df5 100644 --- a/panda/src/bullet/bulletWheel.cxx +++ b/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 // Access: Published diff --git a/panda/src/bullet/bulletWheel.h b/panda/src/bullet/bulletWheel.h index 88dfdcc0fe..539a7420f2 100644 --- a/panda/src/bullet/bulletWheel.h +++ b/panda/src/bullet/bulletWheel.h @@ -23,6 +23,31 @@ #include "luse.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 // Description : One wheel of a BulletVehicle. Instances should not @@ -82,6 +107,7 @@ PUBLISHED: LMatrix4 get_world_transform() const; bool is_front_wheel() const; PandaNode *get_node() const; + BulletWheelRaycastInfo get_raycast_info() const; public: BulletWheel(btWheelInfo &info);