Skip to content

Range.constraints

Bullet Physics provides collision detection and rigid body dynamics for the Blender Game Engine.

Features:

  • Vehicle simulation.
  • Rigid body constraints: hinge and point to point (ball socket).
  • Access to internal physics settings, like deactivation time, and debugging features

physicsid_1, physicsid_2, constraint_type,
pivot_x=0.0, pivot_y=0.0, pivot_z=0.0,
axis_x=0.0, axis_y=0.0, axis_z=0.0, flag=0)

Creates a constraint.

  • physicsid_1: The physics id of the first object in constraint.
    • type: int
  • physicsid_2: The physics id of the second object in constraint.
    • type: int
  • constraint_type: The type of the constraint, see Create Constraint Constants_.
    • type: int
  • pivot_x: Pivot X position. (optional)
    • type: float
  • pivot_y: Pivot Y position. (optional)
    • type: float
  • pivot_z: Pivot Z position. (optional)
    • type: float
  • axis_x: X axis angle in degrees. (optional)
    • type: float
  • axis_y: Y axis angle in degrees. (optional)
    • type: float
  • axis_z: Z axis angle in degrees. (optional)
    • type: float
  • flag: 128 to disable collision between linked bodies. (optional)
    • type: int

Returns: A constraint wrapper.

Return type: KX_ConstraintWrapper

Creates a vehicle constraint.

  • physicsid: The physics id of the chassis object in constraint.
    • type: int

Returns: A vehicle constraint wrapper.

Return type: KX_VehicleWrapper

Exports a file representing the dynamics world (usually using .bullet extension).

See Bullet binary serialization_.

  • filename: File path.
    • type: str
  • constraintId: The id of the constraint.
    • type: int

Returns: The most recent applied impulse.

Return type: float

  • constraintId: The id of the vehicle constraint.
    • type: int

Returns: A vehicle constraint object.

Return type: KX_VehicleWrapper

  • gameobj: The game object with the character physics.
    • type: KX_GameObject

Returns: Character wrapper.

Return type: KX_CharacterWrapper

Removes a constraint.

  • constraintId: The id of the constraint to be removed.
    • type: int

Sets the CCD (Continous Colision Detection) mode in the Physics Environment.

  • ccdMode: The new CCD mode.
    • type: int

setContactBreakingTreshold(breakingTreshold)

Section titled “setContactBreakingTreshold(breakingTreshold)”

Sets tresholds to do with contact point management.

  • breakingTreshold: The new contact breaking treshold.
    • type: float

setDeactivationAngularTreshold(angularTreshold)

Section titled “setDeactivationAngularTreshold(angularTreshold)”

Sets the angular velocity treshold.

  • angularTreshold: New deactivation angular treshold.
    • type: float

setDeactivationLinearTreshold(linearTreshold)

Section titled “setDeactivationLinearTreshold(linearTreshold)”

Sets the linear velocity treshold.

  • linearTreshold: New deactivation linear treshold.
    • type: float

Sets the time after which a resting rigidbody gets deactived.

  • time: The deactivation time.
    • type: float

Sets the debug mode.

  • mode: The new debug mode, see Debug Mode Constants_.
    • type: int

Sets the gravity force.

  • x: Gravity X force.
    • type: float
  • y: Gravity Y force.
    • type: float
  • z: Gravity Z force.
    • type: float

Sets the linear air damping for rigidbodies.

Sets the number of iterations for an iterative constraint solver.

  • numiter: New number of iterations.
    • type: int

Sets the contact penetration tolerance for the active physics scene. A positive value allows objects to overlap by up to slop Blender units before the Bullet solver applies positional correction. The default is 0.0.

This is a scene-wide solver setting: it affects every physical contact in the active scene. It does not change an object’s collision margin or the point at which collisions are detected. Use small values appropriate to the scene scale.

  • slop: Penetration tolerance in Blender units. Use a finite, non-negative value.
    • type: float

Sets the number of substeps for each physics proceed. Tradeoff quality for performance.

  • numsubstep: New number of substeps.
    • type: int

Sets the damper constant of a penalty based solver.

  • damping: New damping for the solver.
    • type: float

Sets the spring constant of a penalty based solver.

  • tau: New tau for the solver.
    • type: float

Sets the solver type.

  • solverType: The new type of the solver.
    • type: int

Sets the successive overrelaxation constant.

  • sor: New sor value.
    • type: float

Symbolic constant string that indicates error.

Type: str

Debug mode to be used with setDebugMode.

No debug.

Draw wireframe in debug.

Draw Axis Aligned Bounding Box in debug.

Draw features text in debug.

Draw contact points in debug.

Debug without help text.

Draw text in debug.

Draw profile timings in debug.

Enable sat comparision in debug.

Disable Bullet LCP.

Enable Continous Collision Detection in debug.

Draw constraints in debug.

Draw constraint limits in debug.

Draw a fast wireframe in debug.

Constraint type to be used with createConstraint.

.. to do

.. to do

.. to do

.. to do

.. to do

.. to do

These items exist in the engine but were not in the Range documentation. The ones marked new in Anastacio were added by Anastacio Engine.

function

Physics solver ERP: how much of the penetration between objects is corrected per step (default 0.2).

function

ERP used with split impulse (default 0.8).

function

Global CFM: makes contacts and joints “softer” (default 0.0).

function

Gyroscopic force limit (explicit mode only).

function

Solves contact position and velocity separately. Avoids objects “popping” when separating.

setSplitImpulsePenetrationThreshold(value)

Section titled “setSplitImpulsePenetrationThreshold(value)”

function

Penetration from which split impulse is used (default -0.04).

function

Split impulse rotation correction (default 0.1).

function

How much the solver reuses the previous frame result (0.0 to 1.0).