"""
Basic Physics Constraint
++++++++++++++++++++++
Example of how to create a hinge Physics Constraint between two objects.
"""
from bge import logic
from bge import constraints
# get object list
objects = logic.getCurrentScene().objects
# get object named Object1 and Object 2
object_1 = objects["Object1"]
object_2 = objects["Object2"]
# want to use Edge constraint type
constraint_type = 2
# get Object1 and Object2 physics IDs
physics_id_1 = object_1.getPhysicsId()
physics_id_2 = object_2.getPhysicsId()
# Use bottom right edge of Object1 for hinge position
edge_position_x = 1.0
edge_position_y = 0.0
edge_position_z = -1.0
# use Object1 y axis for angle to point hinge
edge_angle_x = 0.0
edge_angle_y = 1.0
edge_angle_z = 0.0
# create an edge constraint
constraints.createConstraint(physics_id_1, physics_id_2,
constraint_type,
edge_position_x, edge_position_y, edge_position_z,
edge_angle_x, edge_angle_y, edge_angle_z)
Creates a constraint.
Parameters: |
|
---|
Parameters: |
|
---|
Simbolic constant string that indicates error.
export a .bullet file
Parameters: | filename (string) – File name |
---|
Parameters: | constraintId (int) – The id of the constraint. |
---|---|
Returns: | the most recent applied impulse. |
Return type: | float |
Parameters: | constraintId (int) – The id of the vehicle constraint. |
---|---|
Returns: | a vehicle constraint object. |
Return type: | bge.types.KX_VehicleWrapper |
Removes a constraint.
Parameters: | constraintId (int) – The id of the constraint to be removed. |
---|
Note
Very experimental, not recommended
Sets the CCD (Continous Colision Detection) mode in the Physics Environment.
Parameters: | ccdMode (int) – The new CCD mode. |
---|
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. |
---|
Sets the angular velocity treshold.
Parameters: | angularTreshold (float) – New deactivation angular treshold. |
---|
Sets the linear velocity treshold.
Parameters: | linearTreshold (float) – New deactivation linear treshold. |
---|
Sets the time after which a resting rigidbody gets deactived.
Parameters: | time (float) – The deactivation time. |
---|
Sets the debug mode.
Parameters: | mode (int) – The new debug mode. |
---|
Sets the gravity force.
Parameters: |
|
---|
Note
Not implemented.
Sets the linear air damping for rigidbodies.
Sets the number of iterations for an iterative constraint solver.
Parameters: | numiter (int) – New number of iterations. |
---|
Sets the number of substeps for each physics proceed. Tradeoff quality for performance.
Parameters: | numsubstep (int) – New number of substeps. |
---|
Note
Very experimental, not recommended
Sets the damper constant of a penalty based solver.
Parameters: | damping (float) – New damping for the solver. |
---|
Note
Very experimental, not recommended
Sets the spring constant of a penalty based solver.
Parameters: | tau (float) – New tau for the solver. |
---|
Note
Very experimental, not recommended
Sets the solver type.
Parameters: | solverType (int) – The new type of the solver. |
---|
Note
Very experimental, not recommended
Sets the successive overrelaxation constant.
Parameters: | sor (float) – New sor value. |
---|
Not implemented.
Note
Debug mode to be used with function setDebugMode
No debug.
Note
Debug mode to be used with function setDebugMode
Draw wireframe in debug.
Note
Debug mode to be used with function setDebugMode
Draw Axis Aligned Bounding Box in debug.
Note
Debug mode to be used with function setDebugMode
Draw freatures text in debug.
Note
Debug mode to be used with function setDebugMode
Draw contact points in debug.
Note
Debug mode to be used with function setDebugMode
Debug without help text.
Note
Debug mode to be used with function setDebugMode
Draw text in debug.
Note
Debug mode to be used with function setDebugMode
Draw profile timings in debug.
Note
Debug mode to be used with function setDebugMode
Enable sat comparision in debug.
Note
Debug mode to be used with function setDebugMode
Disable Bullet LCP.
Note
Debug mode to be used with function setDebugMode
Enable Continous Colision Detection in debug.
Note
Debug mode to be used with function setDebugMode
Draw constraints in debug.
Note
Debug mode to be used with function setDebugMode
Draw constraint limits in debug.
Note
Debug mode to be used with function setDebugMode
Draw a fast wireframe in debug.
Note
Constraint type to be used with function createConstraint
Note
Constraint type to be used with function createConstraint
Note
Constraint type to be used with function createConstraint
Note
Constraint type to be used with function createConstraint
Note
Constraint type to be used with function createConstraint