This repository has been archived on 2023-10-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
blender-archive/doc/python_api/rst/bge.constraints.rst
Campbell Barton 421ec97276 Docs: Support out-of-source reference-API builds
This was originally supported, however relative links to examples & templates made it fail.
Now files in the source tree are copied to the build-dir, with ".." replaced with "__"
to avoid having to mirror Blender's source-layout in the Sphinx build-dir.

Also skip uploading the built docs when an SSH user-name isn't passed to sphinx_doc_gen.sh
instead of aborting (so people w/o SSH access to our servers can use the shell-script).
2016-06-12 11:31:28 +10:00

6.7 KiB
Raw Blame History

Sphinx Warnings

11: ERROR: Error in "warning" directive:
unknown option: "start-line".

.. warning:: include not available in preview:  __/examples/bge.constraints.py
   :start-line: 1
   :end-line: 4
15: ERROR: Error in "warning" directive:
unknown option: "lines".

.. warning:: include not available in preview:  __/examples/bge.constraints.py
   :lines: 6-

Note the preview is not accurate and warnings may not indicate real issues.

Physics Constraints (bge.constraints)

Examples

Functions

bge.constraints.createConstraint(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.

Parameters:
  • physicsid_1 (int) The physics id of the first object in constraint.

  • physicsid_2 (int) The physics id of the second object in constraint.

  • constraint_type (int) The type of the constraint, see Create Constraint Constants.

  • pivot_x (float) Pivot X position. (optional)

  • pivot_y (float) Pivot Y position. (optional)

  • pivot_z (float) Pivot Z position. (optional)

  • axis_x (float) X axis angle in degrees. (optional)

  • axis_y (float) Y axis angle in degrees. (optional)

  • axis_z (float) Z axis angle in degrees. (optional)

  • flag (int) 128 to disable collision between linked bodies. (optional)

Returns:

A constraint wrapper.

Return type:

KX_ConstraintWrapper

bge.constraints.exportBulletFile(filename)

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

See Bullet binary serialization.

Parameters:

filename (str) File path.

bge.constraints.getAppliedImpulse(constraintId)
Parameters:

constraintId (int) The id of the constraint.

Returns:

The most recent applied impulse.

Return type:

float

bge.constraints.getVehicleConstraint(constraintId)
Parameters:

constraintId (int) The id of the vehicle constraint.

Returns:

A vehicle constraint object.

Return type:

KX_VehicleWrapper

bge.constraints.getCharacter(gameobj)
Parameters:

gameobj (KX_GameObject) The game object with the character physics.

Returns:

Character wrapper.

Return type:

KX_CharacterWrapper

bge.constraints.removeConstraint(constraintId)

Removes a constraint.

Parameters:

constraintId (int) The id of the constraint to be removed.

bge.constraints.setCcdMode(ccdMode)

Note

Very experimental, not recommended

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

Parameters:

ccdMode (int) The new CCD mode.

bge.constraints.setContactBreakingTreshold(breakingTreshold)

Note

Reasonable default is 0.02 (if units are meters)

Sets tresholds to do with contact point management.

Parameters:

breakingTreshold (float) The new contact breaking treshold.

bge.constraints.setDeactivationAngularTreshold(angularTreshold)

Sets the angular velocity treshold.

Parameters:

angularTreshold (float) New deactivation angular treshold.

bge.constraints.setDeactivationLinearTreshold(linearTreshold)

Sets the linear velocity treshold.

Parameters:

linearTreshold (float) New deactivation linear treshold.

bge.constraints.setDeactivationTime(time)

Sets the time after which a resting rigidbody gets deactived.

Parameters:

time (float) The deactivation time.

bge.constraints.setDebugMode(mode)

Sets the debug mode.

Parameters:

mode (int) The new debug mode, see Debug Mode Constants.

bge.constraints.setGravity(x, y, z)

Sets the gravity force.

Parameters:
  • x (float) Gravity X force.

  • y (float) Gravity Y force.

  • z (float) Gravity Z force.

bge.constraints.setLinearAirDamping(damping)

Note

Not implemented

Sets the linear air damping for rigidbodies.

bge.constraints.setNumIterations(numiter)

Sets the number of iterations for an iterative constraint solver.

Parameters:

numiter (int) New number of iterations.

bge.constraints.setNumTimeSubSteps(numsubstep)

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

Parameters:

numsubstep (int) New number of substeps.

bge.constraints.setSolverDamping(damping)

Note

Very experimental, not recommended

Sets the damper constant of a penalty based solver.

Parameters:

damping (float) New damping for the solver.

bge.constraints.setSolverTau(tau)

Note

Very experimental, not recommended

Sets the spring constant of a penalty based solver.

Parameters:

tau (float) New tau for the solver.

bge.constraints.setSolverType(solverType)

Note

Very experimental, not recommended

Sets the solver type.

Parameters:

solverType (int) The new type of the solver.

bge.constraints.setSorConstant(sor)

Note

Very experimental, not recommended

Sets the successive overrelaxation constant.

Parameters:

sor (float) New sor value.

bge.constraints.setUseEpa(epa)

Note

Not implemented

Constants

bge.constraints.error

Symbolic constant string that indicates error.

Type:

str

Debug Mode Constants

Debug mode to be used with setDebugMode().

bge.constraints.DBG_NODEBUG

No debug.

bge.constraints.DBG_DRAWWIREFRAME

Draw wireframe in debug.

bge.constraints.DBG_DRAWAABB

Draw Axis Aligned Bounding Box in debug.

bge.constraints.DBG_DRAWFREATURESTEXT

Draw features text in debug.

bge.constraints.DBG_DRAWCONTACTPOINTS

Draw contact points in debug.

bge.constraints.DBG_NOHELPTEXT

Debug without help text.

bge.constraints.DBG_DRAWTEXT

Draw text in debug.

bge.constraints.DBG_PROFILETIMINGS

Draw profile timings in debug.

bge.constraints.DBG_ENABLESATCOMPARISION

Enable sat comparision in debug.

bge.constraints.DBG_DISABLEBULLETLCP

Disable Bullet LCP.

bge.constraints.DBG_ENABLECCD

Enable Continous Collision Detection in debug.

bge.constraints.DBG_DRAWCONSTRAINTS

Draw constraints in debug.

bge.constraints.DBG_DRAWCONSTRAINTLIMITS

Draw constraint limits in debug.

bge.constraints.DBG_FASTWIREFRAME

Draw a fast wireframe in debug.

Create Constraint Constants

Constraint type to be used with createConstraint().

bge.constraints.POINTTOPOINT_CONSTRAINT
bge.constraints.LINEHINGE_CONSTRAINT
bge.constraints.ANGULAR_CONSTRAINT
bge.constraints.CONETWIST_CONSTRAINT
bge.constraints.VEHICLE_CONSTRAINT
bge.constraints.GENERIC_6DOF_CONSTRAINT