Changeset View
Standalone View
doc/python_api/rst/bge.constraints.rst
| Physics Constraints (bge.constraints) | Physics Constraints (bge.constraints) | ||||
| ===================================== | ===================================== | ||||
| .. module:: bge.constraints | .. module:: bge.constraints | ||||
| .. literalinclude:: ../examples/bge.constraints.py | .. include:: ../examples/bge.constraints.py | ||||
| :language: rest | :start-line: 1 | ||||
| :lines: 2-4 | :end-line: 4 | ||||
| .. literalinclude:: ../examples/bge.constraints.py | .. literalinclude:: ../examples/bge.constraints.py | ||||
| :lines: 6- | :lines: 6- | ||||
| .. function:: createConstraint(physicsid_1, physicsid_2, constraint_type, pivot_X, pivot_y, pivot_z, axis_x, axis_y, axis_z, flag) | |||||
| Creates a constraint. | Functions | ||||
| +++++++++ | |||||
| Constraints types: | .. function:: 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) | ||||
panzergame: pivot_X -> pivot_x | |||||
MatpiUnsubmitted Not Done Inline ActionsOops, yes, will change. Matpi: Oops, yes, will change. | |||||
| - :class:`POINTTOPOINT_CONSTRAINT` | |||||
| - :class:`LINEHINGE_CONSTRAINT` | Creates a constraint. | ||||
| - :class:`ANGULAR_CONSTRAINT` | |||||
| - :class:`CONETWIST_CONSTRAINT` | |||||
| - :class:`VEHICLE_CONSTRAINT` | |||||
| - :class:`GENERIC_6DOF_CONSTRAINT` | |||||
| :arg physicsid_1: the physics id of the first object in constraint. | :arg physicsid_1: The physics id of the first object in constraint. | ||||
| :type physicsid_1: int | :type physicsid_1: int | ||||
| :arg physicsid_2: the physics id of the second object in constraint. | :arg physicsid_2: The physics id of the second object in constraint. | ||||
| :type physicsid_2: int | :type physicsid_2: int | ||||
| :arg constraint_type: the type of the constraint. | :arg constraint_type: The type of the constraint, one of... | ||||
| * :class:`POINTTOPOINT_CONSTRAINT` | |||||
| * :class:`LINEHINGE_CONSTRAINT` | |||||
| * :class:`ANGULAR_CONSTRAINT` | |||||
| * :class:`CONETWIST_CONSTRAINT` | |||||
| * :class:`VEHICLE_CONSTRAINT` | |||||
| * :class:`GENERIC_6DOF_CONSTRAINT` | |||||
hg1Unsubmitted Not Done Inline ActionsI moved it out of the arguments (with last patch) and have done it like in setDebugMode, because Sphinx always moved the line "The type of the constraint, one of..." into a new line. hg1: I moved it out of the arguments (with last patch) and have done it like in setDebugMode… | |||||
MatpiUnsubmitted Not Done Inline ActionsYes, I am aware of your changes, sorry for acting like I would ignore them... While I fully understand your point on moving it out, I still have to say I find it a bit difficult to read when constraint types are splitted in two... This version is actually a bit better than the one before you moved the list, because now the "Parameters" column (pink) is kept in one single block. About the "one of..." being on a new line, yes I also find it annoying, but still I think I can live with it... I have to say I'd be happy if this version is OK for you. ;-) Matpi: Yes, I am aware of your changes, sorry for acting like I would ignore them...
While I fully… | |||||
| :type constraint_type: int | :type constraint_type: int | ||||
| :arg pivot_x: pivot X position (optional). | :arg pivot_x: Pivot X position. (optional) | ||||
panzergameUnsubmitted Not Done Inline ActionsWhy the dot before "(optional)" ? panzergame: Why the dot before "(optional)" ? | |||||
MatpiUnsubmitted Not Done Inline ActionsI find it nicer: optional is something general, not related to the description text imho. It's not the pivot position that is optional, but the parameter that defines it. Don't know if that makes sense? I would argument the same way for (readonly) flags. If you look at bpy.types objects, they are also flagged with the separation symbol before the brackets (but it that case that's a comma, which is not that nice). Maybe another explaination: the dot is part of the description sentence, not the (optional) flag. For example, what would you consider best:
or
We can still discuss and change it back if it really doesn't make you happy ;-) Matpi: I find it nicer: optional is something general, not related to the description text imho. It's… | |||||
Not Done Inline ActionsOkay panzergame: Okay | |||||
| :type pivot_x: float | :type pivot_x: float | ||||
| :arg pivot_y: pivot Y position (optional). | :arg pivot_y: Pivot Y position. (optional) | ||||
| :type pivot_y: float | :type pivot_y: float | ||||
| :arg pivot_z: pivot Z position (optional). | :arg pivot_z: Pivot Z position. (optional) | ||||
| :type pivot_z: float | :type pivot_z: float | ||||
| :arg axis_x: X axis angle in degrees (optional). | :arg axis_x: X axis angle in degrees. (optional) | ||||
| :type axis_x: float | :type axis_x: float | ||||
| :arg axis_y: Y axis angle in degrees (optional). | :arg axis_y: Y axis angle in degrees. (optional) | ||||
| :type axis_y: float | :type axis_y: float | ||||
| :arg axis_z: Z axis angle in degrees (optional). | :arg axis_z: Z axis angle in degrees. (optional) | ||||
| :type axis_z: float | :type axis_z: float | ||||
| :arg flag: 128 to disable collision between linked bodies (optional). | :arg flag: 128 to disable collision between linked bodies. (optional) | ||||
panzergameUnsubmitted Not Done Inline Actionsit could be nice to set a constant for this, like : DISABLE_COLLISION_LINKED_BODIES. panzergame: it could be nice to set a constant for this, like : DISABLE_COLLISION_LINKED_BODIES. | |||||
MatpiUnsubmitted Not Done Inline ActionsBut then there would be a need for another constant for the opposite effect... It would actually be much nicer to have a boolean value here... We can still expose DISABLE_COLLISION_LINKED_BODIES to Python if you wish. Matpi: But then there would be a need for another constant for the opposite effect... It would… | |||||
Not Done Inline ActionsYou can add 2 module macro: panzergame: You can add 2 module macro:
DISABLE_COLLISION_LINKED_BODIES = 128… | |||||
| :type flag: int | :type flag: int | ||||
| :return: a constraint wrapper. | :return: A constraint wrapper. | ||||
| :rtype: :class:`bge.types.KX_ConstraintWrapper` | :rtype: :class:`~bge.types.KX_ConstraintWrapper` | ||||
hg1Unsubmitted Not Done Inline ActionsDo you really think it looks better if we only print KX_ConstraintWrapper instead of bge.types.KX_ConstraintWrapper? hg1: Do you really think it looks better if we only print KX_ConstraintWrapper instead of bge.types. | |||||
MatpiUnsubmitted Not Done Inline ActionsI don't really know, actually. I have seen quite many places in the doc where all those prefixes are cut off, and so I overtook that habit. In this precise case I think it's ok, because:
It would be fully ok for me to keep those prefixes though, BUT then I would like to harmonize that behaviour through the whole BGE api doc (what matters most to me in a doc is consistence, so we simply have to agree with each other on the general settings before). Matpi: I don't really know, actually. I have seen quite many places in the doc where all those… | |||||
| .. attribute:: error | |||||
| Symbolic constant string that indicates error. | |||||
| .. function:: exportBulletFile(filename) | .. function:: exportBulletFile(filename) | ||||
| export a .bullet file | Exports a .bullet file. | ||||
panzergameUnsubmitted Not Done Inline ActionsCould you give more info about the file name ? Relative path or absolute ? We can use "//" ? panzergame: Could you give more info about the file name ? Relative path or absolute ? We can use "//" ? | |||||
MatpiUnsubmitted Not Done Inline ActionsDunno, think absolute/relative are possible (FILE* file = fopen(filename,"wb");). Need to check. Matpi: Dunno, think absolute/relative are possible (FILE* file = fopen(filename,"wb");). Need to check. | |||||
panzergameUnsubmitted Not Done Inline Actionsit will nice to add the link about bullet serialization : http://bulletphysics.org/mediawiki-1.5.8/index.php/Bullet_binary_serialization panzergame: it will nice to add the link about bullet serialization : http://bulletphysics.org/mediawiki-1. | |||||
| :arg filename: File name | :arg filename: File name. | ||||
| :type filename: string | :type filename: str | ||||
| .. function:: getAppliedImpulse(constraintId) | .. function:: getAppliedImpulse(constraintId) | ||||
| :arg constraintId: The id of the constraint. | :arg constraintId: The id of the constraint. | ||||
| :type constraintId: int | :type constraintId: int | ||||
| :return: the most recent applied impulse. | :return: The most recent applied impulse. | ||||
| :rtype: float | :rtype: float | ||||
| .. function:: getVehicleConstraint(constraintId) | .. function:: getVehicleConstraint(constraintId) | ||||
| :arg constraintId: The id of the vehicle constraint. | :arg constraintId: The id of the vehicle constraint. | ||||
| :type constraintId: int | :type constraintId: int | ||||
| :return: a vehicle constraint object. | :return: A vehicle constraint object. | ||||
| :rtype: :class:`bge.types.KX_VehicleWrapper` | :rtype: :class:`~bge.types.KX_VehicleWrapper` | ||||
| .. function:: getCharacter(gameobj) | .. function:: getCharacter(gameobj) | ||||
| :arg gameobj: The game object with the character physics. | :arg gameobj: The game object with the character physics. | ||||
| :type gameobj: :class:`bge.types.KX_GameObject` | :type gameobj: :class:`~bge.types.KX_GameObject` | ||||
| :return: character wrapper | :return: Character wrapper. | ||||
| :rtype: :class:`bge.types.KX_CharacterWrapper` | :rtype: :class:`~bge.types.KX_CharacterWrapper` | ||||
| .. function:: removeConstraint(constraintId) | .. function:: removeConstraint(constraintId) | ||||
| Removes a constraint. | Removes a constraint. | ||||
| :arg constraintId: The id of the constraint to be removed. | :arg constraintId: The id of the constraint to be removed. | ||||
| :type constraintId: int | :type constraintId: int | ||||
| Show All 35 Lines | .. function:: setDeactivationTime(time) | ||||
| Sets the time after which a resting rigidbody gets deactived. | Sets the time after which a resting rigidbody gets deactived. | ||||
| :arg time: The deactivation time. | :arg time: The deactivation time. | ||||
| :type time: float | :type time: float | ||||
| .. function:: setDebugMode(mode) | .. function:: setDebugMode(mode) | ||||
| Sets the debug mode. | Sets the debug mode, one of... | ||||
| Debug modes: | * :class:`DBG_NODEBUG` | ||||
| - :class:`DBG_NODEBUG` | * :class:`DBG_DRAWWIREFRAME` | ||||
| - :class:`DBG_DRAWWIREFRAME` | * :class:`DBG_DRAWAABB` | ||||
| - :class:`DBG_DRAWAABB` | * :class:`DBG_DRAWFREATURESTEXT` | ||||
| - :class:`DBG_DRAWFREATURESTEXT` | * :class:`DBG_DRAWCONTACTPOINTS` | ||||
| - :class:`DBG_DRAWCONTACTPOINTS` | * :class:`DBG_NOHELPTEXT` | ||||
| - :class:`DBG_NOHELPTEXT` | * :class:`DBG_DRAWTEXT` | ||||
| - :class:`DBG_DRAWTEXT` | * :class:`DBG_PROFILETIMINGS` | ||||
| - :class:`DBG_PROFILETIMINGS` | * :class:`DBG_ENABLESATCOMPARISION` | ||||
| - :class:`DBG_ENABLESATCOMPARISION` | * :class:`DBG_DISABLEBULLETLCP` | ||||
| - :class:`DBG_DISABLEBULLETLCP` | * :class:`DBG_ENABLECCD` | ||||
| - :class:`DBG_ENABLECCD` | * :class:`DBG_DRAWCONSTRAINTS` | ||||
| - :class:`DBG_DRAWCONSTRAINTS` | * :class:`DBG_DRAWCONSTRAINTLIMITS` | ||||
| - :class:`DBG_DRAWCONSTRAINTLIMITS` | * :class:`DBG_FASTWIREFRAME` | ||||
| - :class:`DBG_FASTWIREFRAME` | |||||
| :arg mode: The new debug mode. | :arg mode: The new debug mode. | ||||
| :type mode: int | :type mode: int | ||||
| .. function:: setGravity(x, y, z) | .. function:: setGravity(x, y, z) | ||||
| Sets the gravity force. | Sets the gravity force. | ||||
| :arg x: Gravity X force. | :arg x: Gravity X force. | ||||
| :type x: float | :type x: float | ||||
| :arg y: Gravity Y force. | :arg y: Gravity Y force. | ||||
| :type y: float | :type y: float | ||||
| :arg z: Gravity Z force. | :arg z: Gravity Z force. | ||||
| :type z: float | :type z: float | ||||
| .. function:: setLinearAirDamping(damping) | .. function:: setLinearAirDamping(damping) | ||||
| .. note:: | .. note:: | ||||
| Not implemented. | Not implemented | ||||
| Sets the linear air damping for rigidbodies. | Sets the linear air damping for rigidbodies. | ||||
| .. function:: setNumIterations(numiter) | .. function:: setNumIterations(numiter) | ||||
| Sets the number of iterations for an iterative constraint solver. | Sets the number of iterations for an iterative constraint solver. | ||||
| :arg numiter: New number of iterations. | :arg numiter: New number of iterations. | ||||
| ▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | .. function:: setSorConstant(sor) | ||||
| Sets the successive overrelaxation constant. | Sets the successive overrelaxation constant. | ||||
| :arg sor: New sor value. | :arg sor: New sor value. | ||||
| :type sor: float | :type sor: float | ||||
| .. function:: setUseEpa(epa) | .. function:: setUseEpa(epa) | ||||
| Not implemented. | .. note:: | ||||
| Not implemented | |||||
| Constants | |||||
| +++++++++ | |||||
| .. attribute:: error | |||||
| Symbolic constant string that indicates error. | |||||
| :type: str | |||||
| :value: "PhysicsConstraints.error" | |||||
| .. data:: DBG_NODEBUG | .. data:: DBG_NODEBUG | ||||
| .. note:: | .. note:: | ||||
| Debug mode to be used with function :class:`setDebugMode` | Debug mode to be used with function :class:`setDebugMode` | ||||
| No debug. | No debug. | ||||
| :type: int | |||||
Not Done Inline ActionsWouldn't but the actual values in, just enough to note that they're int bitmasks. If they change - its a hassle to maintain. campbellbarton: Wouldn't but the actual values in, just enough to note that they're int bitmasks.
If they… | |||||
Not Done Inline ActionsMakes sense - and the actual values don't matter much. Changed. Matpi: Makes sense - and the actual values don't matter much.
Changed. | |||||
| :value: 0 | |||||
| .. data:: DBG_DRAWWIREFRAME | .. data:: DBG_DRAWWIREFRAME | ||||
| .. note:: | .. note:: | ||||
| Debug mode to be used with function :class:`setDebugMode` | Debug mode to be used with function :class:`setDebugMode` | ||||
| Draw wireframe in debug. | Draw wireframe in debug. | ||||
| :type: int | |||||
| :value: 1 | |||||
| .. data:: DBG_DRAWAABB | .. data:: DBG_DRAWAABB | ||||
| .. note:: | .. note:: | ||||
| Debug mode to be used with function :class:`setDebugMode` | Debug mode to be used with function :class:`setDebugMode` | ||||
| Draw Axis Aligned Bounding Box in debug. | Draw Axis Aligned Bounding Box in debug. | ||||
| :type: int | |||||
| :value: 2 | |||||
| .. data:: DBG_DRAWFREATURESTEXT | .. data:: DBG_DRAWFREATURESTEXT | ||||
| .. note:: | .. note:: | ||||
| Debug mode to be used with function :class:`setDebugMode` | Debug mode to be used with function :class:`setDebugMode` | ||||
| Draw freatures text in debug. | Draw features text in debug. | ||||
| :type: int | |||||
| :value: 4 | |||||
| .. data:: DBG_DRAWCONTACTPOINTS | .. data:: DBG_DRAWCONTACTPOINTS | ||||
| .. note:: | .. note:: | ||||
| Debug mode to be used with function :class:`setDebugMode` | Debug mode to be used with function :class:`setDebugMode` | ||||
| Draw contact points in debug. | Draw contact points in debug. | ||||
| :type: int | |||||
| :value: 8 | |||||
| .. data:: DBG_NOHELPTEXT | .. data:: DBG_NOHELPTEXT | ||||
| .. note:: | .. note:: | ||||
| Debug mode to be used with function :class:`setDebugMode` | Debug mode to be used with function :class:`setDebugMode` | ||||
| Debug without help text. | Debug without help text. | ||||
| :type: int | |||||
| :value: 32 | |||||
| .. data:: DBG_DRAWTEXT | .. data:: DBG_DRAWTEXT | ||||
| .. note:: | .. note:: | ||||
| Debug mode to be used with function :class:`setDebugMode` | Debug mode to be used with function :class:`setDebugMode` | ||||
| Draw text in debug. | Draw text in debug. | ||||
| :type: int | |||||
| :value: 64 | |||||
| .. data:: DBG_PROFILETIMINGS | .. data:: DBG_PROFILETIMINGS | ||||
| .. note:: | .. note:: | ||||
| Debug mode to be used with function :class:`setDebugMode` | Debug mode to be used with function :class:`setDebugMode` | ||||
| Draw profile timings in debug. | Draw profile timings in debug. | ||||
| :type: int | |||||
| :value: 128 | |||||
| .. data:: DBG_ENABLESATCOMPARISION | .. data:: DBG_ENABLESATCOMPARISION | ||||
| .. note:: | .. note:: | ||||
| Debug mode to be used with function :class:`setDebugMode` | Debug mode to be used with function :class:`setDebugMode` | ||||
| Enable sat comparision in debug. | Enable sat comparision in debug. | ||||
| :type: int | |||||
| :value: 256 | |||||
| .. data:: DBG_DISABLEBULLETLCP | .. data:: DBG_DISABLEBULLETLCP | ||||
| .. note:: | .. note:: | ||||
| Debug mode to be used with function :class:`setDebugMode` | Debug mode to be used with function :class:`setDebugMode` | ||||
| Disable Bullet LCP. | Disable Bullet LCP. | ||||
| :type: int | |||||
| :value: 512 | |||||
| .. data:: DBG_ENABLECCD | .. data:: DBG_ENABLECCD | ||||
| .. note:: | .. note:: | ||||
| Debug mode to be used with function :class:`setDebugMode` | Debug mode to be used with function :class:`setDebugMode` | ||||
| Enable Continous Colision Detection in debug. | Enable Continous Collision Detection in debug. | ||||
| :type: int | |||||
| :value: 1024 | |||||
| .. data:: DBG_DRAWCONSTRAINTS | .. data:: DBG_DRAWCONSTRAINTS | ||||
| .. note:: | .. note:: | ||||
| Debug mode to be used with function :class:`setDebugMode` | Debug mode to be used with function :class:`setDebugMode` | ||||
| Draw constraints in debug. | Draw constraints in debug. | ||||
| :type: int | |||||
| :value: 2048 | |||||
| .. data:: DBG_DRAWCONSTRAINTLIMITS | .. data:: DBG_DRAWCONSTRAINTLIMITS | ||||
| .. note:: | .. note:: | ||||
| Debug mode to be used with function :class:`setDebugMode` | Debug mode to be used with function :class:`setDebugMode` | ||||
| Draw constraint limits in debug. | Draw constraint limits in debug. | ||||
| :type: int | |||||
| :value: 4096 | |||||
| .. data:: DBG_FASTWIREFRAME | .. data:: DBG_FASTWIREFRAME | ||||
| .. note:: | .. note:: | ||||
| Debug mode to be used with function :class:`setDebugMode` | Debug mode to be used with function :class:`setDebugMode` | ||||
| Draw a fast wireframe in debug. | Draw a fast wireframe in debug. | ||||
| :type: int | |||||
| :value: 8192 | |||||
| .. data:: POINTTOPOINT_CONSTRAINT | .. data:: POINTTOPOINT_CONSTRAINT | ||||
| .. note:: | .. note:: | ||||
| Constraint type to be used with function :class:`createConstraint` | Constraint type to be used with function :class:`createConstraint` | ||||
| .. to do | .. to do | ||||
| :type: int | |||||
| :value: 1 | |||||
| .. data:: LINEHINGE_CONSTRAINT | .. data:: LINEHINGE_CONSTRAINT | ||||
| .. note:: | .. note:: | ||||
| Constraint type to be used with function :class:`createConstraint` | Constraint type to be used with function :class:`createConstraint` | ||||
| .. to do | .. to do | ||||
| :type: int | |||||
| :value: 2 | |||||
| .. data:: ANGULAR_CONSTRAINT | .. data:: ANGULAR_CONSTRAINT | ||||
| .. note:: | .. note:: | ||||
| Constraint type to be used with function :class:`createConstraint` | Constraint type to be used with function :class:`createConstraint` | ||||
| .. to do | .. to do | ||||
| :type: int | |||||
| :value: 3 | |||||
| .. data:: CONETWIST_CONSTRAINT | .. data:: CONETWIST_CONSTRAINT | ||||
| .. note:: | .. note:: | ||||
| Constraint type to be used with function :class:`createConstraint` | Constraint type to be used with function :class:`createConstraint` | ||||
| .. to do | .. to do | ||||
| :type: int | |||||
| :value: 4 | |||||
| .. data:: VEHICLE_CONSTRAINT | .. data:: VEHICLE_CONSTRAINT | ||||
| .. note:: | .. note:: | ||||
| Constraint type to be used with function :class:`createConstraint` | Constraint type to be used with function :class:`createConstraint` | ||||
| .. to do | .. to do | ||||
| :type: int | |||||
| :value: 11 | |||||
| .. data:: GENERIC_6DOF_CONSTRAINT | .. data:: GENERIC_6DOF_CONSTRAINT | ||||
| .. note:: | .. note:: | ||||
| Constraint type to be used with function :class:`createConstraint` | Constraint type to be used with function :class:`createConstraint` | ||||
| .. to do | .. to do | ||||
| :type: int | |||||
| :value: 12 | |||||
pivot_X -> pivot_x