# BulletHingeConstraint

class BulletHingeConstraint

Bases: BulletConstraint

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.

Inheritance diagram

explicit BulletHingeConstraint(BulletRigidBodyNode const *node_a, LPoint3 const &pivot_a, LVector3 const &axis_a, bool use_frame_a = false)
explicit BulletHingeConstraint(BulletRigidBodyNode const *node_a, BulletRigidBodyNode const *node_b, LPoint3 const &pivot_a, LPoint3 const &pivot_b, LVector3 const &axis_a, LVector3 const &axis_b, bool use_frame_a = false)
explicit BulletHingeConstraint(BulletRigidBodyNode const *node_a, TransformState const *ts_a, bool use_frame_a = false)
explicit BulletHingeConstraint(BulletRigidBodyNode const *node_a, BulletRigidBodyNode const *node_b, TransformState const *ts_a, TransformState const *ts_b, bool use_frame_a = false)

Creates a hinge constraint which connects one rigid body with some fixe dpoint in the world.

Constructs a hinge constraint which connects two rigid bodies.

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.

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!

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 where max_impulse is the maximum impulse that is used for achieving the specified velocity.

Note that the target_velocity is in radians/second, not degrees.

void enable_motor(bool enable)
bool get_angular_only(void) const
static TypeHandle get_class_type(void)
ConstPointerTo<TransformState> get_frame_a(void) const
ConstPointerTo<TransformState> get_frame_b(void) const
PN_stdfloat get_hinge_angle(void)

Returns the angle between node_a and node_b in degrees.

PN_stdfloat get_lower_limit(void) const

Returns the lower angular limit in degrees.

PN_stdfloat get_upper_limit(void) const

Returns the upper angular limit in degrees.

void set_angular_only(bool value)
void set_axis(LVector3 const &axis)

Sets the hinge’s rotation axis in world coordinates.

void set_frames(TransformState const *ts_a, TransformState const *ts_b)
void set_limit(PN_stdfloat low, PN_stdfloat high, PN_stdfloat softness = 0.9, PN_stdfloat bias = 0.30000000000000007, PN_stdfloat relaxation = 1.0)

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(LQuaternion const &quat, PN_stdfloat dt)
void set_motor_target(PN_stdfloat target_angle, PN_stdfloat dt)