Panda3D
Public Member Functions | Static Public Member Functions
BulletHingeConstraint Class Reference

The hinge constraint lets two bodies rotate around a given axis while adhering to specified limits. More...

#include "bulletHingeConstraint.h"

Inheritance diagram for BulletHingeConstraint:
BulletConstraint TypedReferenceCount TypedObject ReferenceCount MemoryBase MemoryBase

List of all members.

Public Member Functions

 BulletHingeConstraint (const BulletRigidBodyNode *node_a, const LPoint3 &pivot_a, const LVector3 &axis_a, bool use_frame_a=false)
 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 (const BulletRigidBodyNode *node_a, const BulletRigidBodyNode *node_b, const LPoint3 &pivot_a, const LPoint3 &pivot_b, const LVector3 &axis_a, const LVector3 &axis_b, bool use_frame_a=false)
 Creates a hinge connecting node_a to node_b.
void enable_angular_motor (bool enable, PN_stdfloat target_velocity, PN_stdfloat max_impulse)
 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 enable_motor (bool enable)
virtual TypeHandle force_init_type ()
bool get_angular_only () const
PN_stdfloat get_hinge_angle ()
 Returns the angle between node_a and node_b in degrees.
PN_stdfloat get_lower_limit () const
 Returns the lower angular limit in degrees.
virtual TypeHandle get_type () const
PN_stdfloat get_upper_limit () const
 Returns the upper angular limit in degrees.
virtual btTypedConstraint * ptr () const
void set_angular_only (bool value)
void set_axis (const LVector3 &axis)
 Sets the hinge's rotation axis in world coordinates.
void set_limit (PN_stdfloat low, PN_stdfloat high, PN_stdfloat softness=0.9f, PN_stdfloat bias=0.3f, PN_stdfloat relaxation=1.0f)
 Sets the lower and upper rotational limits in degrees.
void set_max_motor_impulse (PN_stdfloat max_impulse)
 Sets the maximum impulse used to achieve the velocity set in enable_angular_motor.
void set_motor_target (const LQuaternion &quat, PN_stdfloat dt)
void set_motor_target (PN_stdfloat target_angle, PN_stdfloat dt)

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()
 This function is declared non-inline to work around a compiler bug in g++ 2.96.

Detailed 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.

Definition at line 34 of file bulletHingeConstraint.h.


Constructor & Destructor Documentation

BulletHingeConstraint::BulletHingeConstraint ( const BulletRigidBodyNode node_a,
const LPoint3 pivot_a,
const LVector3 axis_a,
bool  use_frame_a = false 
)

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.

Definition at line 31 of file bulletHingeConstraint.cxx.

BulletHingeConstraint::BulletHingeConstraint ( const BulletRigidBodyNode node_a,
const BulletRigidBodyNode node_b,
const LPoint3 pivot_a,
const LPoint3 pivot_b,
const LVector3 axis_a,
const LVector3 axis_b,
bool  use_frame_a = false 
)

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!

Definition at line 55 of file bulletHingeConstraint.cxx.


Member Function Documentation

void BulletHingeConstraint::enable_angular_motor ( bool  enable,
PN_stdfloat  target_velocity,
PN_stdfloat  max_impulse 
)

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.

Definition at line 181 of file bulletHingeConstraint.cxx.

Returns the angle between node_a and node_b in degrees.

Definition at line 166 of file bulletHingeConstraint.cxx.

Returns the lower angular limit in degrees.

Definition at line 143 of file bulletHingeConstraint.cxx.

Returns the upper angular limit in degrees.

Definition at line 154 of file bulletHingeConstraint.cxx.

static void BulletHingeConstraint::init_type ( ) [inline, static]

This function is declared non-inline to work around a compiler bug in g++ 2.96.

Making it inline seems to cause problems in the optimizer.

Reimplemented from BulletConstraint.

Definition at line 76 of file bulletHingeConstraint.h.

References BulletConstraint::init_type().

void BulletHingeConstraint::set_axis ( const LVector3 axis)

Sets the hinge's rotation axis in world coordinates.

Definition at line 129 of file bulletHingeConstraint.cxx.

References LVecBase3f::is_nan().

void BulletHingeConstraint::set_limit ( PN_stdfloat  low,
PN_stdfloat  high,
PN_stdfloat  softness = 0.9f,
PN_stdfloat  bias = 0.3f,
PN_stdfloat  relaxation = 1.0f 
)

Sets the lower and upper rotational limits in degrees.

Definition at line 114 of file bulletHingeConstraint.cxx.

void BulletHingeConstraint::set_max_motor_impulse ( PN_stdfloat  max_impulse)

Sets the maximum impulse used to achieve the velocity set in enable_angular_motor.

Definition at line 204 of file bulletHingeConstraint.cxx.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations