Browse Source

Added some documentation. Thanks to tanuva who provided the descriptions.

enn0x 14 years ago
parent
commit
948a3810e1

+ 26 - 9
panda/src/bullet/bulletHingeConstraint.cxx

@@ -22,7 +22,10 @@ TypeHandle BulletHingeConstraint::_type_handle;
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletHingeConstraint::Constructor
 //     Function: BulletHingeConstraint::Constructor
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Creates a hinge constraint in the same way as the
+//               other constructor, but uses the world as second
+//               body so that node_a is fixed to some point in
+//               mid-air for example.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 BulletHingeConstraint::
 BulletHingeConstraint::
 BulletHingeConstraint(const BulletRigidBodyNode *node_a, 
 BulletHingeConstraint(const BulletRigidBodyNode *node_a, 
@@ -40,7 +43,13 @@ BulletHingeConstraint(const BulletRigidBodyNode *node_a,
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletHingeConstraint::Constructor
 //     Function: BulletHingeConstraint::Constructor
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Creates a hinge connecting node_a to node_b. The
+//               pivot point is the point at which the body is fixed
+//               to the constraint. In other words: It specifies
+//               where on each body the rotation axis should be. This
+//               axis is specified using axis_a and axis_b.
+//               Remember, everything is specified in the bodies own
+//               coordinate system!
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 BulletHingeConstraint::
 BulletHingeConstraint::
 BulletHingeConstraint(const BulletRigidBodyNode *node_a,
 BulletHingeConstraint(const BulletRigidBodyNode *node_a,
@@ -98,7 +107,8 @@ get_angular_only() const {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletHingeConstraint::set_limit
 //     Function: BulletHingeConstraint::set_limit
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Sets the lower and upper rotational limits in
+//               degrees.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void BulletHingeConstraint::
 void BulletHingeConstraint::
 set_limit(float low, float high, float softness, float bias, float relaxation) {
 set_limit(float low, float high, float softness, float bias, float relaxation) {
@@ -112,7 +122,8 @@ set_limit(float low, float high, float softness, float bias, float relaxation) {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletHingeConstraint::set_axis
 //     Function: BulletHingeConstraint::set_axis
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Sets the hinge's rotation axis in world
+//               coordinates.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void BulletHingeConstraint::
 void BulletHingeConstraint::
 set_axis(const LVector3f &axis) {
 set_axis(const LVector3f &axis) {
@@ -126,7 +137,7 @@ set_axis(const LVector3f &axis) {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletHingeConstraint::get_lower_limit
 //     Function: BulletHingeConstraint::get_lower_limit
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Returns the lower angular limit in degrees.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 float BulletHingeConstraint::
 float BulletHingeConstraint::
 get_lower_limit() const {
 get_lower_limit() const {
@@ -137,7 +148,7 @@ get_lower_limit() const {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletHingeConstraint::get_upper_limit
 //     Function: BulletHingeConstraint::get_upper_limit
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Returns the upper angular limit in degrees.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 float BulletHingeConstraint::
 float BulletHingeConstraint::
 get_upper_limit() const {
 get_upper_limit() const {
@@ -148,7 +159,8 @@ get_upper_limit() const {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletHingeConstraint::get_hinge_angle
 //     Function: BulletHingeConstraint::get_hinge_angle
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Returns the angle between node_a and node_b in
+//               degrees.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 float BulletHingeConstraint::
 float BulletHingeConstraint::
 get_hinge_angle() {
 get_hinge_angle() {
@@ -159,7 +171,11 @@ get_hinge_angle() {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletHingeConstraint::enable_angular_motor
 //     Function: BulletHingeConstraint::enable_angular_motor
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Applies an impulse to the constraint so that the
+//               angle changes at target_velocity (probably
+//               degrees/second) where max_impulse is the maximum
+//               impulse that is used for achieving the specified
+//               velocity.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void BulletHingeConstraint::
 void BulletHingeConstraint::
 enable_angular_motor(bool enable, float target_velocity, float max_impulse) {
 enable_angular_motor(bool enable, float target_velocity, float max_impulse) {
@@ -181,7 +197,8 @@ enable_motor(bool enable) {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletHingeConstraint::set_max_motor_impulse
 //     Function: BulletHingeConstraint::set_max_motor_impulse
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Sets the maximum impulse used to achieve the
+//               velocity set in enable_angular_motor.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void BulletHingeConstraint::
 void BulletHingeConstraint::
 set_max_motor_impulse(float max_impulse) {
 set_max_motor_impulse(float max_impulse) {

+ 3 - 1
panda/src/bullet/bulletHingeConstraint.h

@@ -29,7 +29,9 @@ class BulletRigidBodyNode;
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //       Class : BulletHingeConstraint
 //       Class : BulletHingeConstraint
-// Description : 
+// Description : The hinge constraint lets two bodies rotate around
+//               a given axis while adhering to specified limits.
+//               It's motor can apply angular force to them.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDABULLET BulletHingeConstraint : public BulletConstraint {
 class EXPCL_PANDABULLET BulletHingeConstraint : public BulletConstraint {
 
 

+ 5 - 2
panda/src/bullet/bulletVehicle.I

@@ -38,7 +38,10 @@ get_vehicle() const {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletVehicle::get_tuning
 //     Function: BulletVehicle::get_tuning
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Returns a reference to the BulletVehicleTuning
+//               object of this vehicle which offers various
+//               vehicle-global tuning options. Make sure to
+//               configure this before adding wheels!
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 BulletVehicleTuning &BulletVehicle::
 BulletVehicleTuning &BulletVehicle::
 get_tuning() {
 get_tuning() {
@@ -49,7 +52,7 @@ get_tuning() {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletVehicle::get_num_wheels
 //     Function: BulletVehicle::get_num_wheels
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Returns the number of wheels this vehicle has.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 INLINE int BulletVehicle::
 INLINE int BulletVehicle::
 get_num_wheels() const {
 get_num_wheels() const {

+ 24 - 12
panda/src/bullet/bulletVehicle.cxx

@@ -22,7 +22,8 @@ TypeHandle BulletVehicle::_type_handle;
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletVehicle::Constructor
 //     Function: BulletVehicle::Constructor
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Creates a new BulletVehicle instance in the given
+//               world and with a chassis node.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 BulletVehicle::
 BulletVehicle::
 BulletVehicle(BulletWorld *world, BulletRigidBodyNode *chassis) {
 BulletVehicle(BulletWorld *world, BulletRigidBodyNode *chassis) {
@@ -38,7 +39,8 @@ BulletVehicle(BulletWorld *world, BulletRigidBodyNode *chassis) {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletVehicle::set_coordinate_system
 //     Function: BulletVehicle::set_coordinate_system
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Specifies which axis is "up". Nessecary for the
+//               vehicle's suspension to work properly!
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void BulletVehicle::
 void BulletVehicle::
 set_coordinate_system(BulletUpAxis up) {
 set_coordinate_system(BulletUpAxis up) {
@@ -62,7 +64,9 @@ set_coordinate_system(BulletUpAxis up) {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletVehicle::get_forward_vector
 //     Function: BulletVehicle::get_forward_vector
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Returns the forward vector representing the car's
+//               actual direction of movement. The forward vetcor
+//               is given in global coordinates.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 LVector3f BulletVehicle::
 LVector3f BulletVehicle::
 get_forward_vector() const {
 get_forward_vector() const {
@@ -73,7 +77,8 @@ get_forward_vector() const {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletVehicle::get_chassis
 //     Function: BulletVehicle::get_chassis
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Returns the chassis of this vehicle. The chassis
+//               is a rigid body node.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 BulletRigidBodyNode *BulletVehicle::
 BulletRigidBodyNode *BulletVehicle::
 get_chassis() {
 get_chassis() {
@@ -85,7 +90,8 @@ get_chassis() {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletVehicle::get_current_speed_km_hour
 //     Function: BulletVehicle::get_current_speed_km_hour
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Returns the current speed in kilometers per hour.
+//               Convert to miles using: km/h * 0.62 = mph
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 float BulletVehicle::
 float BulletVehicle::
 get_current_speed_km_hour() const {
 get_current_speed_km_hour() const {
@@ -96,7 +102,7 @@ get_current_speed_km_hour() const {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletVehicle::reset_suspension
 //     Function: BulletVehicle::reset_suspension
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Resets the vehicle's suspension.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void BulletVehicle::
 void BulletVehicle::
 reset_suspension() {
 reset_suspension() {
@@ -107,7 +113,8 @@ reset_suspension() {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletVehicle::get_steering_value
 //     Function: BulletVehicle::get_steering_value
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Returns the steering angle of the wheel with index
+//               idx in degrees.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 float BulletVehicle::
 float BulletVehicle::
 get_steering_value(int idx) const {
 get_steering_value(int idx) const {
@@ -119,7 +126,8 @@ get_steering_value(int idx) const {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletVehicle::set_steering_value
 //     Function: BulletVehicle::set_steering_value
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Sets the steering value (in degrees) of the wheel
+//               with index idx.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void BulletVehicle::
 void BulletVehicle::
 set_steering_value(float steering, int idx) {
 set_steering_value(float steering, int idx) {
@@ -131,7 +139,8 @@ set_steering_value(float steering, int idx) {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletVehicle::apply_engine_force
 //     Function: BulletVehicle::apply_engine_force
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Applies force at the wheel with index idx for
+//               acceleration.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void BulletVehicle::
 void BulletVehicle::
 apply_engine_force(float force, int idx) {
 apply_engine_force(float force, int idx) {
@@ -143,7 +152,7 @@ apply_engine_force(float force, int idx) {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletVehicle::set_brake
 //     Function: BulletVehicle::set_brake
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Applies braking force to the wheel with index idx.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void BulletVehicle::
 void BulletVehicle::
 set_brake(float brake, int idx) {
 set_brake(float brake, int idx) {
@@ -166,7 +175,8 @@ set_pitch_control(float pitch) {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletVehicle::create_wheel
 //     Function: BulletVehicle::create_wheel
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Factory method for creating wheels for this
+//               vehicle instance.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 BulletWheel BulletVehicle::
 BulletWheel BulletVehicle::
 create_wheel() {
 create_wheel() {
@@ -208,7 +218,9 @@ get_axis(int idx) {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletVehicle::get_wheel
 //     Function: BulletVehicle::get_wheel
 //       Access: Published
 //       Access: Published
-//  Description:
+//  Description: Returns the BulletWheel with index idx. Causes an
+//               AssertionError if idx is equal or larger than the
+//               number of wheels.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 BulletWheel BulletVehicle::
 BulletWheel BulletVehicle::
 get_wheel(int idx) const {
 get_wheel(int idx) const {

+ 5 - 1
panda/src/bullet/bulletVehicle.h

@@ -30,7 +30,11 @@ class BulletWheel;
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //       Class : BulletVehicleTuning
 //       Class : BulletVehicleTuning
-// Description : 
+// Description : Simulates a raycast vehicle which casts a ray per
+//               wheel at the ground as a cheap replacement for
+//               complex suspension simulation. The suspension can
+//               be tuned in various ways. It is possible to add a
+//               (probably) arbitrary number of wheels.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 class BulletVehicleTuning {
 class BulletVehicleTuning {