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
Examples
Section titled “Examples”Functions
Section titled “Functions”createConstraint( \
Section titled “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.
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, seeCreate 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
createVehicle(physicsid)
Section titled “createVehicle(physicsid)”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
exportBulletFile(filename)
Section titled “exportBulletFile(filename)”Exports a file representing the dynamics world (usually using .bullet extension).
See Bullet binary serialization_.
filename: File path.- type: str
getAppliedImpulse(constraintId)
Section titled “getAppliedImpulse(constraintId)”constraintId: The id of the constraint.- type: int
Returns: The most recent applied impulse.
Return type: float
getVehicleConstraint(constraintId)
Section titled “getVehicleConstraint(constraintId)”constraintId: The id of the vehicle constraint.- type: int
Returns: A vehicle constraint object.
Return type: KX_VehicleWrapper
getCharacter(gameobj)
Section titled “getCharacter(gameobj)”gameobj: The game object with the character physics.- type:
KX_GameObject
- type:
Returns: Character wrapper.
Return type: KX_CharacterWrapper
removeConstraint(constraintId)
Section titled “removeConstraint(constraintId)”Removes a constraint.
constraintId: The id of the constraint to be removed.- type: int
setCcdMode(ccdMode)
Section titled “setCcdMode(ccdMode)”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
setDeactivationTime(time)
Section titled “setDeactivationTime(time)”Sets the time after which a resting rigidbody gets deactived.
time: The deactivation time.- type: float
setDebugMode(mode)
Section titled “setDebugMode(mode)”Sets the debug mode.
mode: The new debug mode, seeDebug Mode Constants_.- type: int
setGravity(x, y, z)
Section titled “setGravity(x, y, z)”Sets the gravity force.
x: Gravity X force.- type: float
y: Gravity Y force.- type: float
z: Gravity Z force.- type: float
setLinearAirDamping(damping)
Section titled “setLinearAirDamping(damping)”Sets the linear air damping for rigidbodies.
setNumIterations(numiter)
Section titled “setNumIterations(numiter)”Sets the number of iterations for an iterative constraint solver.
numiter: New number of iterations.- type: int
setLinearSlop(slop)
Section titled “setLinearSlop(slop)”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
setNumTimeSubSteps(numsubstep)
Section titled “setNumTimeSubSteps(numsubstep)”Sets the number of substeps for each physics proceed. Tradeoff quality for performance.
numsubstep: New number of substeps.- type: int
setSolverDamping(damping)
Section titled “setSolverDamping(damping)”Sets the damper constant of a penalty based solver.
damping: New damping for the solver.- type: float
setSolverTau(tau)
Section titled “setSolverTau(tau)”Sets the spring constant of a penalty based solver.
tau: New tau for the solver.- type: float
setSolverType(solverType)
Section titled “setSolverType(solverType)”Sets the solver type.
solverType: The new type of the solver.- type: int
setSorConstant(sor)
Section titled “setSorConstant(sor)”Sets the successive overrelaxation constant.
sor: New sor value.- type: float
setUseEpa(epa)
Section titled “setUseEpa(epa)”Constants
Section titled “Constants”Symbolic constant string that indicates error.
Type: str
Debug Mode Constants
Section titled “Debug Mode Constants”Debug mode to be used with setDebugMode.
DBG_NODEBUG
Section titled “DBG_NODEBUG”No debug.
DBG_DRAWWIREFRAME
Section titled “DBG_DRAWWIREFRAME”Draw wireframe in debug.
DBG_DRAWAABB
Section titled “DBG_DRAWAABB”Draw Axis Aligned Bounding Box in debug.
DBG_DRAWFREATURESTEXT
Section titled “DBG_DRAWFREATURESTEXT”Draw features text in debug.
DBG_DRAWCONTACTPOINTS
Section titled “DBG_DRAWCONTACTPOINTS”Draw contact points in debug.
DBG_NOHELPTEXT
Section titled “DBG_NOHELPTEXT”Debug without help text.
DBG_DRAWTEXT
Section titled “DBG_DRAWTEXT”Draw text in debug.
DBG_PROFILETIMINGS
Section titled “DBG_PROFILETIMINGS”Draw profile timings in debug.
DBG_ENABLESATCOMPARISION
Section titled “DBG_ENABLESATCOMPARISION”Enable sat comparision in debug.
DBG_DISABLEBULLETLCP
Section titled “DBG_DISABLEBULLETLCP”Disable Bullet LCP.
DBG_ENABLECCD
Section titled “DBG_ENABLECCD”Enable Continous Collision Detection in debug.
DBG_DRAWCONSTRAINTS
Section titled “DBG_DRAWCONSTRAINTS”Draw constraints in debug.
DBG_DRAWCONSTRAINTLIMITS
Section titled “DBG_DRAWCONSTRAINTLIMITS”Draw constraint limits in debug.
DBG_FASTWIREFRAME
Section titled “DBG_FASTWIREFRAME”Draw a fast wireframe in debug.
Create Constraint Constants
Section titled “Create Constraint Constants”Constraint type to be used with createConstraint.
POINTTOPOINT_CONSTRAINT
Section titled “POINTTOPOINT_CONSTRAINT”.. to do
LINEHINGE_CONSTRAINT
Section titled “LINEHINGE_CONSTRAINT”.. to do
ANGULAR_CONSTRAINT
Section titled “ANGULAR_CONSTRAINT”.. to do
CONETWIST_CONSTRAINT
Section titled “CONETWIST_CONSTRAINT”.. to do
VEHICLE_CONSTRAINT
Section titled “VEHICLE_CONSTRAINT”.. to do
GENERIC_6DOF_CONSTRAINT
Section titled “GENERIC_6DOF_CONSTRAINT”.. to do
Not in the Range documentation
Section titled “Not in the Range documentation”These items exist in the engine but were not in the Range documentation. The ones marked new in Anastacio were added by Anastacio Engine.
setErp(value)
Section titled “setErp(value)”function
Physics solver ERP: how much of the penetration between objects is corrected per step (default 0.2).
setErp2(value)
Section titled “setErp2(value)”function
ERP used with split impulse (default 0.8).
setGlobalCfm(value)
Section titled “setGlobalCfm(value)”function
Global CFM: makes contacts and joints “softer” (default 0.0).
setMaxGyroscopicForce(value)
Section titled “setMaxGyroscopicForce(value)”function
Gyroscopic force limit (explicit mode only).
setSplitImpulse(enabled)
Section titled “setSplitImpulse(enabled)”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).
setSplitImpulseTurnErp(value)
Section titled “setSplitImpulseTurnErp(value)”function
Split impulse rotation correction (default 0.1).
setWarmstartingFactor(value)
Section titled “setWarmstartingFactor(value)”function
How much the solver reuses the previous frame result (0.0 to 1.0).
