2010-05-17 19:52:25 +00:00
2011-07-30 23:16:22 +00:00
Game Logic (bge.logic)
2011-07-31 03:15:37 +00:00
======================
2012-10-02 14:15:02 +00:00
***** ***** **
Introduction
***** ***** **
2010-06-02 22:56:08 +00:00
2010-05-17 19:52:25 +00:00
Module to access logic functions, imported automatically into the python controllers namespace.
.. module :: bge.logic
.. code-block :: python
# To get the controller thats running this python script:
cont = bge.logic.getCurrentController() # bge.logic is automatically imported
# To get the game object this controller is on:
obj = cont.owner
2011-07-06 07:05:29 +00:00
:class: `~bge.types.KX_GameObject` and :class: `~bge.types.KX_Camera` or :class: `~bge.types.KX_LightObject` methods are available depending on the type of object
2010-05-17 19:52:25 +00:00
.. code-block :: python
# To get a sensor linked to this controller.
# "sensorname" is the name of the sensor as defined in the Blender interface.
# +---------------------+ +--------+
# | Sensor "sensorname" +--+ Python +
# +---------------------+ +--------+
sens = cont.sensors["sensorname"]
# To get a sequence of all sensors:
sensors = co.sensors
See the sensor's reference for available methods:
2010-06-02 22:56:08 +00:00
.. hlist ::
:columns: 3
* :class: `~bge.types.KX_MouseFocusSensor`
* :class: `~bge.types.KX_NearSensor`
* :class: `~bge.types.KX_NetworkMessageSensor`
* :class: `~bge.types.KX_RadarSensor`
* :class: `~bge.types.KX_RaySensor`
* :class: `~bge.types.KX_TouchSensor`
* :class: `~bge.types.SCA_DelaySensor`
* :class: `~bge.types.SCA_JoystickSensor`
* :class: `~bge.types.SCA_KeyboardSensor`
* :class: `~bge.types.SCA_MouseSensor`
* :class: `~bge.types.SCA_PropertySensor`
* :class: `~bge.types.SCA_RandomSensor`
2010-05-17 19:52:25 +00:00
You can also access actuators linked to the controller
.. code-block :: python
# To get an actuator attached to the controller:
# +--------+ +-------------------------+
# + Python +--+ Actuator "actuatorname" |
# +--------+ +-------------------------+
actuator = co.actuators["actuatorname"]
# Activate an actuator
controller.activate(actuator)
See the actuator's reference for available methods
2010-06-02 22:56:08 +00:00
.. hlist ::
:columns: 3
* :class: `~bge.types.BL_ActionActuator`
* :class: `~bge.types.KX_CameraActuator`
* :class: `~bge.types.KX_ConstraintActuator`
* :class: `~bge.types.KX_GameActuator`
* :class: `~bge.types.KX_NetworkMessageActuator`
* :class: `~bge.types.KX_ObjectActuator`
* :class: `~bge.types.KX_ParentActuator`
* :class: `~bge.types.KX_SCA_AddObjectActuator`
* :class: `~bge.types.KX_SCA_DynamicActuator`
* :class: `~bge.types.KX_SCA_EndObjectActuator`
* :class: `~bge.types.KX_SCA_ReplaceMeshActuator`
* :class: `~bge.types.KX_SceneActuator`
* :class: `~bge.types.KX_SoundActuator`
* :class: `~bge.types.KX_StateActuator`
* :class: `~bge.types.KX_TrackToActuator`
* :class: `~bge.types.KX_VisibilityActuator`
* :class: `~bge.types.SCA_2DFilterActuator`
* :class: `~bge.types.SCA_PropertyActuator`
* :class: `~bge.types.SCA_RandomActuator`
2010-05-17 19:52:25 +00:00
Most logic brick's methods are accessors for the properties available in the logic buttons.
Consult the logic bricks documentation for more information on how each logic brick works.
There are also methods to access the current :class: `bge.types.KX_Scene`
.. code-block :: python
# Get the current scene
scene = bge.logic.getCurrentScene()
# Get the current camera
cam = scene.active_camera
Matricies as used by the game engine are **row major**
`` matrix[row][col] = float ``
2011-10-17 02:20:53 +00:00
:class: `bge.types.KX_Camera` has some examples using matrices.
2010-05-17 19:52:25 +00:00
2010-06-02 22:56:08 +00:00
***** *** *
Variables
***** *** *
2010-05-17 19:52:25 +00:00
.. data :: globalDict
A dictionary that is saved between loading blend files so you can use it to store inventory and other variables you want to store between scenes and blend files.
It can also be written to a file and loaded later on with the game load/save actuators.
2010-06-02 22:56:08 +00:00
.. note :: only python built in types such as int/string/bool/float/tuples/lists can be saved, GameObjects, Actuators etc will not work as expected.
.. data :: keyboard
The current keyboard wrapped in an :class: `~bge.types.SCA_PythonKeyboard` object.
2010-05-17 19:52:25 +00:00
2010-06-02 22:56:08 +00:00
.. data :: mouse
The current mouse wrapped in an :class: `~bge.types.SCA_PythonMouse` object.
2012-12-21 02:28:59 +00:00
.. data :: joysticks
2013-09-18 05:20:43 +00:00
A list of attached :class: `~bge.types.SCA_PythonJoystick` .
The list size is the maximum number of supported joysticks.
If no joystick is available for a given slot, the slot is set to None.
2012-12-21 02:28:59 +00:00
2010-06-02 22:56:08 +00:00
***** ***** ***** **
General functions
***** ***** ***** **
2010-05-17 19:52:25 +00:00
.. function :: getCurrentController()
Gets the Python controller associated with this Python script.
:rtype: :class:`bge.types.SCA_PythonController`
.. function :: getCurrentScene()
Gets the current Scene.
:rtype: :class:`bge.types.KX_Scene`
.. function :: getSceneList()
Gets a list of the current scenes loaded in the game engine.
:rtype: list of :class:`bge.types.KX_Scene`
.. note :: Scenes in your blend file that have not been converted wont be in this list. This list will only contain scenes such as overlays scenes.
.. function :: loadGlobalDict()
Loads bge.logic.globalDict from a file.
.. function :: saveGlobalDict()
Saves bge.logic.globalDict to a file.
2010-07-16 09:10:46 +00:00
.. function :: startGame(blend)
Loads the blend file.
:arg blend: The name of the blend file
:type blend: string
.. function :: endGame()
Ends the current game.
.. function :: restartGame()
Restarts the current game by reloading the .blend file (the last saved version, not what is currently running).
2012-12-22 05:38:32 +00:00
.. function :: LibLoad(blend, type, data, load_actions=False, verbose=False, load_scripts=True, async=False)
2010-07-16 09:10:46 +00:00
Converts the all of the datablocks of the given type from the given blend.
2010-08-28 02:07:55 +00:00
:arg blend: The path to the blend file (or the name to use for the library if data is supplied)
2010-07-16 09:10:46 +00:00
:type blend: string
2010-10-09 10:45:25 +00:00
:arg type: The datablock type (currently only "Action", "Mesh" and "Scene" are supported)
2010-07-16 09:10:46 +00:00
:type type: string
2010-08-28 02:07:55 +00:00
:arg data: Binary data from a blend file (optional)
:type data: bytes
2011-04-07 04:00:56 +00:00
:arg load_actions: Search for and load all actions in a given Scene and not just the "active" actions (Scene type only)
:type load_actions: bool
:arg verbose: Whether or not to print debugging information (e.g., "SceneName: Scene")
:type verbose: bool
2012-07-22 22:58:12 +00:00
:arg load_scripts: Whether or not to load text datablocks as well (can be disabled for some extra security)
2012-12-22 05:38:32 +00:00
:type load_scripts: bool
:arg async: Whether or not to do the loading asynchronously (in another thread). Only the "Scene" type is currently supported for this feature.
:type async: bool
:rtype: :class:`bge.types.KX_LibLoadStatus`
.. note :: Asynchronously loaded libraries will not be available immediately after LibLoad() returns. Use the returned KX_LibLoadStatus to figure out when the libraries are ready.
2010-07-16 09:10:46 +00:00
.. function :: LibNew(name, type, data)
Uses existing datablock data and loads in as a new library.
:arg name: A unique library name used for removal later
:type name: string
:arg type: The datablock type (currently only "Mesh" is supported)
:type type: string
:arg data: A list of names of the datablocks to load
:type data: list of strings
.. function :: LibFree(name)
Frees a library, removing all objects and meshes from the currently active scenes.
:arg name: The name of the library to free (the name used in LibNew)
:type name: string
2011-04-07 04:00:56 +00:00
.. function :: LibList()
Returns a list of currently loaded libraries.
:rtype: list [str]
2010-07-16 09:10:46 +00:00
2010-05-17 19:52:25 +00:00
.. function :: addScene(name, overlay=1)
Loads a scene into the game engine.
2011-08-09 13:50:27 +00:00
.. note ::
This function is not effective immediately, the scene is queued
2011-08-09 14:16:22 +00:00
and added on the next logic cycle where it will be available
from `getSceneList`
2011-08-09 13:50:27 +00:00
2010-05-17 19:52:25 +00:00
:arg name: The name of the scene
:type name: string
:arg overlay: Overlay or underlay (optional)
:type overlay: integer
.. function :: sendMessage(subject, body="", to="", message_from="")
Sends a message to sensors in any active scene.
:arg subject: The subject of the message
:type subject: string
:arg body: The body of the message (optional)
:type body: string
:arg to: The name of the object to send the message to (optional)
:type to: string
:arg message_from: The name of the object that the message is coming from (optional)
:type message_from: string
.. function :: setGravity(gravity)
Sets the world gravity.
:type gravity: list [fx, fy, fz]
.. function :: getSpectrum()
Returns a 512 point list from the sound card.
This only works if the fmod sound driver is being used.
:rtype: list [float], len(getSpectrum()) == 512
.. function :: getMaxLogicFrame()
2010-07-16 09:10:46 +00:00
Gets the maximum number of logic frames per render frame.
2010-05-17 19:52:25 +00:00
2010-07-16 09:10:46 +00:00
:return: The maximum number of logic frames per render frame
2010-05-17 19:52:25 +00:00
:rtype: integer
.. function :: setMaxLogicFrame(maxlogic)
2010-07-16 09:10:46 +00:00
Sets the maximum number of logic frames that are executed per render frame.
2010-05-17 19:52:25 +00:00
This does not affect the physic system that still runs at full frame rate.
2010-07-16 09:10:46 +00:00
:arg maxlogic: The new maximum number of logic frames per render frame. Valid values: 1..5
2010-05-17 19:52:25 +00:00
:type maxlogic: integer
.. function :: getMaxPhysicsFrame()
2010-07-16 09:10:46 +00:00
Gets the maximum number of physics frames per render frame.
2010-05-17 19:52:25 +00:00
2010-07-16 09:10:46 +00:00
:return: The maximum number of physics frames per render frame
2010-05-17 19:52:25 +00:00
:rtype: integer
.. function :: setMaxPhysicsFrame(maxphysics)
Sets the maximum number of physics timestep that are executed per render frame.
Higher value allows physics to keep up with realtime even if graphics slows down the game.
Physics timestep is fixed and equal to 1/tickrate (see setLogicTicRate)
maxphysics/ticrate is the maximum delay of the renderer that physics can compensate.
:arg maxphysics: The new maximum number of physics timestep per render frame. Valid values: 1..5.
:type maxphysics: integer
.. function :: getLogicTicRate()
Gets the logic update frequency.
:return: The logic frequency in Hz
:rtype: float
.. function :: setLogicTicRate(ticrate)
Sets the logic update frequency.
The logic update frequency is the number of times logic bricks are executed every second.
The default is 60 Hz.
:arg ticrate: The new logic update frequency (in Hz).
:type ticrate: float
.. function :: getPhysicsTicRate()
Gets the physics update frequency
:return: The physics update frequency in Hz
:rtype: float
.. warning: Not implimented yet
.. function :: setPhysicsTicRate(ticrate)
Sets the physics update frequency
The physics update frequency is the number of times the physics system is executed every second.
The default is 60 Hz.
:arg ticrate: The new update frequency (in Hz).
:type ticrate: float
.. warning: Not implimented yet
2012-11-22 06:04:12 +00:00
.. function :: getExitKey()
Gets the key used to exit the game engine
:return: The key (defaults to :mod:`bge.events.ESCKEY`)
:rtype: int
.. function :: setExitKey(key)
Sets the key used to exit the game engine
:arg key: A key constant from :mod:`bge.events`
2012-11-22 22:38:31 +00:00
:type key: int
2012-11-22 06:04:12 +00:00
2012-11-22 22:38:31 +00:00
.. function :: NextFrame()
Render next frame (if Python has control)
2012-11-22 06:04:12 +00:00
2010-06-02 22:56:08 +00:00
***** ***** ***** **
2010-05-17 19:52:25 +00:00
Utility functions
2010-06-02 22:56:08 +00:00
***** ***** ***** **
2010-05-17 19:52:25 +00:00
.. function :: expandPath(path)
Converts a blender internal path into a proper file system path.
Use / as directory separator in path
You can use '//' at the start of the string to define a relative path;
2013-08-13 07:48:07 +00:00
Blender replaces that string by the directory of the current .blend or runtime file
to make a full path name. The function also converts the directory separator to
the local file system format.
2010-05-17 19:52:25 +00:00
:arg path: The path string to be converted/expanded.
:type path: string
:return: The converted string
:rtype: string
2010-06-02 22:56:08 +00:00
.. function :: getAverageFrameRate()
2011-06-14 07:46:38 +00:00
Gets the estimated/average framerate for all the active scenes, not only the current scene.
2011-06-14 09:41:29 +00:00
:return: The estimated average framerate in frames per second
2010-06-02 22:56:08 +00:00
:rtype: float
2010-05-17 19:52:25 +00:00
.. function :: getBlendFileList(path = "//")
Returns a list of blend files in the same directory as the open blend file, or from using the option argument.
:arg path: Optional directory argument, will be expanded (like expandPath) into the full path.
:type path: string
:return: A list of filenames, with no directory prefix
:rtype: list
.. function :: getRandomFloat()
Returns a random floating point value in the range [0 - 1)
2010-06-02 22:56:08 +00:00
.. function :: PrintGLInfo()
Prints GL Extension Info into the console
2012-11-22 22:38:31 +00:00
.. function :: PrintMemInfo()
Prints engine statistics into the console
2013-03-19 04:56:51 +00:00
.. function :: getProfileInfo()
Returns a Python dictionary that contains the same information as the on screen profiler. The keys are the profiler categories and the values are tuples with the first element being time taken (in ms) and the second element being the percentage of total time.
2010-06-02 22:56:08 +00:00
***** *** *
2010-05-17 19:52:25 +00:00
Constants
2010-06-02 22:56:08 +00:00
***** *** *
2010-05-17 19:52:25 +00:00
2010-06-02 21:28:17 +00:00
.. data :: KX_TRUE
True value used by some modules.
.. data :: KX_FALSE
False value used by some modules.
2010-05-17 19:52:25 +00:00
2010-06-02 22:56:08 +00:00
=======
Sensors
=======
2010-06-07 23:50:43 +00:00
.. _sensor-status:
-------------
Sensor Status
-------------
.. data :: KX_SENSOR_INACTIVE
.. data :: KX_SENSOR_JUST_ACTIVATED
.. data :: KX_SENSOR_ACTIVE
.. data :: KX_SENSOR_JUST_DEACTIVATED
2012-11-28 01:14:11 +00:00
---------------
2012-11-22 11:09:42 +00:00
Armature Sensor
2012-11-28 01:14:11 +00:00
---------------
2012-11-22 11:09:42 +00:00
.. _armaturesensor-type:
See :class: `bge.types.KX_ArmatureSensor.type`
.. data :: KX_ARMSENSOR_STATE_CHANGED
Detect that the constraint is changing state (active/inactive)
:value: 0
.. data :: KX_ARMSENSOR_LIN_ERROR_BELOW
Detect that the constraint linear error is above a threshold
:value: 1
.. data :: KX_ARMSENSOR_LIN_ERROR_ABOVE
Detect that the constraint linear error is below a threshold
:value: 2
.. data :: KX_ARMSENSOR_ROT_ERROR_BELOW
Detect that the constraint rotation error is above a threshold
:value: 3
.. data :: KX_ARMSENSOR_ROT_ERROR_ABOVE
Detect that the constraint rotation error is below a threshold
:value: 4
2010-06-07 23:50:43 +00:00
.. _logic-property-sensor:
2010-05-17 19:52:25 +00:00
---------------
Property Sensor
---------------
.. data :: KX_PROPSENSOR_EQUAL
Activate when the property is equal to the sensor value.
2010-06-07 23:50:43 +00:00
:value: 1
2010-05-17 19:52:25 +00:00
.. data :: KX_PROPSENSOR_NOTEQUAL
Activate when the property is not equal to the sensor value.
2010-06-07 23:50:43 +00:00
:value: 2
2010-05-17 19:52:25 +00:00
.. data :: KX_PROPSENSOR_INTERVAL
Activate when the property is between the specified limits.
2010-06-07 23:50:43 +00:00
:value: 3
2010-05-17 19:52:25 +00:00
.. data :: KX_PROPSENSOR_CHANGED
2010-06-07 23:50:43 +00:00
Activate when the property changes
:value: 4
2010-05-17 19:52:25 +00:00
.. data :: KX_PROPSENSOR_EXPRESSION
Activate when the expression matches
2010-06-07 23:50:43 +00:00
:value: 5
2010-05-17 19:52:25 +00:00
2010-06-02 22:56:08 +00:00
------------
Radar Sensor
------------
See :class: `bge.types.KX_RadarSensor`
.. data :: KX_RADAR_AXIS_POS_X
.. data :: KX_RADAR_AXIS_POS_Y
.. data :: KX_RADAR_AXIS_POS_Z
.. data :: KX_RADAR_AXIS_NEG_X
.. data :: KX_RADAR_AXIS_NEG_Y
.. data :: KX_RADAR_AXIS_NEG_Z
----------
Ray Sensor
----------
See :class: `bge.types.KX_RaySensor`
.. data :: KX_RAY_AXIS_POS_X
.. data :: KX_RAY_AXIS_POS_Y
.. data :: KX_RAY_AXIS_POS_Z
.. data :: KX_RAY_AXIS_NEG_X
.. data :: KX_RAY_AXIS_NEG_Y
.. data :: KX_RAY_AXIS_NEG_Z
=========
Actuators
=========
2010-06-07 23:50:43 +00:00
.. _action-actuator:
2010-06-02 22:56:08 +00:00
---------------
Action Actuator
---------------
See :class: `bge.types.BL_ActionActuator`
.. data :: KX_ACTIONACT_PLAY
2012-01-30 06:47:01 +00:00
.. data :: KX_ACTIONACT_PINGPONG
2010-06-02 22:56:08 +00:00
.. data :: KX_ACTIONACT_FLIPPER
.. data :: KX_ACTIONACT_LOOPSTOP
.. data :: KX_ACTIONACT_LOOPEND
.. data :: KX_ACTIONACT_PROPERTY
2012-11-28 01:14:11 +00:00
-----------------
2012-11-22 07:52:17 +00:00
Armature Actuator
2012-11-28 01:14:11 +00:00
-----------------
2012-11-22 07:52:17 +00:00
.. _armatureactuator-constants-type:
2012-11-22 09:12:21 +00:00
See :class: `bge.types.BL_ArmatureActuator.type`
2012-11-22 07:52:17 +00:00
2012-11-22 09:12:21 +00:00
.. data :: KX_ACT_ARMATURE_RUN
2012-11-22 07:52:17 +00:00
2012-11-22 09:12:21 +00:00
Just make sure the armature will be updated on the next graphic frame.
This is the only persistent mode of the actuator:
it executes automatically once per frame until stopped by a controller
:value: 0
2012-11-22 07:52:17 +00:00
2012-11-22 09:12:21 +00:00
.. data :: KX_ACT_ARMATURE_ENABLE
2012-11-22 07:52:17 +00:00
2012-11-22 09:12:21 +00:00
Enable the constraint.
2012-11-28 01:14:11 +00:00
2012-11-22 09:12:21 +00:00
:value: 1
2012-11-22 07:52:17 +00:00
2012-11-22 09:12:21 +00:00
.. data :: KX_ACT_ARMATURE_DISABLE
2012-11-22 07:52:17 +00:00
2012-11-22 09:12:21 +00:00
Disable the constraint (runtime constraint values are not updated).
2012-11-28 01:14:11 +00:00
2012-11-22 09:12:21 +00:00
:value: 2
2012-11-22 07:52:17 +00:00
2012-11-22 09:12:21 +00:00
.. data :: KX_ACT_ARMATURE_SETTARGET
2012-11-22 07:52:17 +00:00
2012-11-22 09:12:21 +00:00
Change target and subtarget of constraint.
:value: 3
2012-11-22 07:52:17 +00:00
2012-11-22 09:12:21 +00:00
.. data :: KX_ACT_ARMATURE_SETWEIGHT
2012-11-22 07:52:17 +00:00
2012-11-22 09:12:21 +00:00
Change weight of constraint (IK only).
2012-11-22 07:52:17 +00:00
2012-11-22 09:12:21 +00:00
:value: 4
2012-11-22 07:52:17 +00:00
2012-11-22 09:12:21 +00:00
.. data :: KX_ACT_ARMATURE_SETINFLUENCE
2012-11-22 07:52:17 +00:00
2012-11-22 09:12:21 +00:00
Change influence of constraint.
:value: 5
2012-11-22 07:52:17 +00:00
2010-05-17 19:52:25 +00:00
-------------------
Constraint Actuator
-------------------
2010-06-07 23:50:43 +00:00
.. _constraint-actuator-option:
See :class: `bge.types.KX_ConstraintActuator.option`
* Applicable to Distance constraint:
2012-11-22 09:12:21 +00:00
.. data :: KX_CONSTRAINTACT_NORMAL
2010-06-07 23:50:43 +00:00
Activate alignment to surface
2012-11-22 09:12:21 +00:00
.. data :: KX_CONSTRAINTACT_DISTANCE
2010-06-07 23:50:43 +00:00
Activate distance control
2012-11-22 09:12:21 +00:00
.. data :: KX_CONSTRAINTACT_LOCAL
2010-06-07 23:50:43 +00:00
Direction of the ray is along the local axis
* Applicable to Force field constraint:
2012-11-22 09:12:21 +00:00
.. data :: KX_CONSTRAINTACT_DOROTFH
2010-06-07 23:50:43 +00:00
Force field act on rotation as well
* Applicable to both:
2012-11-22 09:12:21 +00:00
.. data :: KX_CONSTRAINTACT_MATERIAL
2010-06-07 23:50:43 +00:00
Detect material rather than property
2012-11-22 09:12:21 +00:00
.. data :: KX_CONSTRAINTACT_PERMANENT
2010-06-07 23:50:43 +00:00
No deactivation if ray does not hit target
.. _constraint-actuator-limit:
See :class: `bge.types.KX_ConstraintActuator.limit`
2010-05-17 19:52:25 +00:00
.. data :: KX_CONSTRAINTACT_LOCX
2010-06-02 21:28:17 +00:00
Limit X coord.
2010-05-17 19:52:25 +00:00
.. data :: KX_CONSTRAINTACT_LOCY
2010-06-02 21:28:17 +00:00
Limit Y coord
2010-05-17 19:52:25 +00:00
.. data :: KX_CONSTRAINTACT_LOCZ
2010-06-02 21:28:17 +00:00
Limit Z coord
2010-05-17 19:52:25 +00:00
.. data :: KX_CONSTRAINTACT_ROTX
2010-06-02 21:28:17 +00:00
Limit X rotation
2010-05-17 19:52:25 +00:00
.. data :: KX_CONSTRAINTACT_ROTY
2010-06-02 21:28:17 +00:00
Limit Y rotation
2010-05-17 19:52:25 +00:00
.. data :: KX_CONSTRAINTACT_ROTZ
2010-06-02 21:28:17 +00:00
Limit Z rotation
2010-05-17 19:52:25 +00:00
.. data :: KX_CONSTRAINTACT_DIRNX
2010-06-02 21:28:17 +00:00
Set distance along negative X axis
2010-05-17 19:52:25 +00:00
.. data :: KX_CONSTRAINTACT_DIRNY
2010-06-02 21:28:17 +00:00
Set distance along negative Y axis
.. data :: KX_CONSTRAINTACT_DIRNZ
Set distance along negative Z axis
2010-05-17 19:52:25 +00:00
.. data :: KX_CONSTRAINTACT_DIRPX
2010-06-02 21:28:17 +00:00
Set distance along positive X axis
2010-05-17 19:52:25 +00:00
.. data :: KX_CONSTRAINTACT_DIRPY
2010-06-02 21:28:17 +00:00
Set distance along positive Y axis
.. data :: KX_CONSTRAINTACT_DIRPZ
Set distance along positive Z axis
2010-05-17 19:52:25 +00:00
.. data :: KX_CONSTRAINTACT_ORIX
2010-06-02 21:28:17 +00:00
Set orientation of X axis
2010-05-17 19:52:25 +00:00
.. data :: KX_CONSTRAINTACT_ORIY
2010-06-02 21:28:17 +00:00
Set orientation of Y axis
2010-05-17 19:52:25 +00:00
.. data :: KX_CONSTRAINTACT_ORIZ
2010-06-02 21:28:17 +00:00
Set orientation of Z axis
2012-11-21 08:53:04 +00:00
.. data :: KX_CONSTRAINTACT_FHNX
2010-06-02 21:28:17 +00:00
Set force field along negative X axis
2012-11-21 08:53:04 +00:00
.. data :: KX_CONSTRAINTACT_FHNY
2010-06-02 21:28:17 +00:00
Set force field along negative Y axis
2012-11-21 08:53:04 +00:00
.. data :: KX_CONSTRAINTACT_FHNZ
2010-06-02 21:28:17 +00:00
Set force field along negative Z axis
2012-11-21 08:53:04 +00:00
.. data :: KX_CONSTRAINTACT_FHPX
2010-06-02 21:28:17 +00:00
Set force field along positive X axis
2012-11-21 08:53:04 +00:00
.. data :: KX_CONSTRAINTACT_FHPY
2010-06-02 21:28:17 +00:00
Set force field along positive Y axis
2012-11-21 08:53:04 +00:00
.. data :: KX_CONSTRAINTACT_FHPZ
2010-06-02 21:28:17 +00:00
Set force field along positive Z axis
2010-06-02 22:56:08 +00:00
----------------
Dynamic Actuator
----------------
See :class: `bge.types.KX_SCA_DynamicActuator`
.. data :: KX_DYN_RESTORE_DYNAMICS
.. data :: KX_DYN_DISABLE_DYNAMICS
.. data :: KX_DYN_ENABLE_RIGID_BODY
.. data :: KX_DYN_DISABLE_RIGID_BODY
.. data :: KX_DYN_SET_MASS
2010-06-07 23:50:43 +00:00
.. _game-actuator:
2010-06-02 22:56:08 +00:00
-------------
Game Actuator
-------------
See :class: `bge.types.KX_GameActuator`
.. data :: KX_GAME_LOAD
.. data :: KX_GAME_START
.. data :: KX_GAME_RESTART
.. data :: KX_GAME_QUIT
.. data :: KX_GAME_SAVECFG
.. data :: KX_GAME_LOADCFG
2010-06-02 21:28:17 +00:00
2010-06-02 22:56:08 +00:00
---------------
Parent Actuator
---------------
.. data :: KX_PARENT_REMOVE
.. data :: KX_PARENT_SET
2010-06-07 23:50:43 +00:00
.. _logic-random-distributions:
2010-05-17 19:52:25 +00:00
--------------------
Random Distributions
--------------------
See :class: `bge.types.SCA_RandomActuator`
.. data :: KX_RANDOMACT_BOOL_CONST
.. data :: KX_RANDOMACT_BOOL_UNIFORM
.. data :: KX_RANDOMACT_BOOL_BERNOUILLI
.. data :: KX_RANDOMACT_INT_CONST
.. data :: KX_RANDOMACT_INT_UNIFORM
.. data :: KX_RANDOMACT_INT_POISSON
.. data :: KX_RANDOMACT_FLOAT_CONST
.. data :: KX_RANDOMACT_FLOAT_UNIFORM
.. data :: KX_RANDOMACT_FLOAT_NORMAL
.. data :: KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL
2010-06-02 22:56:08 +00:00
--------------
Scene Actuator
--------------
2010-05-17 19:52:25 +00:00
2010-06-02 22:56:08 +00:00
See :class: `bge.types.KX_SceneActuator`
2010-05-17 19:52:25 +00:00
2010-06-02 22:56:08 +00:00
.. data :: KX_SCENE_RESTART
.. data :: KX_SCENE_SET_SCENE
.. data :: KX_SCENE_SET_CAMERA
.. data :: KX_SCENE_ADD_FRONT_SCENE
.. data :: KX_SCENE_ADD_BACK_SCENE
.. data :: KX_SCENE_REMOVE_SCENE
.. data :: KX_SCENE_SUSPEND
.. data :: KX_SCENE_RESUME
2010-05-17 19:52:25 +00:00
2010-06-07 23:50:43 +00:00
.. _logic-sound-actuator:
2010-05-17 19:52:25 +00:00
--------------
Sound Actuator
--------------
2010-06-07 23:50:43 +00:00
2010-05-17 19:52:25 +00:00
See :class: `bge.types.KX_SoundActuator`
.. data :: KX_SOUNDACT_PLAYSTOP
2010-06-07 23:50:43 +00:00
:value: 1
2010-05-17 19:52:25 +00:00
.. data :: KX_SOUNDACT_PLAYEND
2010-06-07 23:50:43 +00:00
:value: 2
2010-05-17 19:52:25 +00:00
.. data :: KX_SOUNDACT_LOOPSTOP
2010-06-07 23:50:43 +00:00
:value: 3
2010-05-17 19:52:25 +00:00
.. data :: KX_SOUNDACT_LOOPEND
2010-06-07 23:50:43 +00:00
:value: 4
2010-05-17 19:52:25 +00:00
.. data :: KX_SOUNDACT_LOOPBIDIRECTIONAL
2010-06-07 23:50:43 +00:00
:value: 5
2010-05-17 19:52:25 +00:00
.. data :: KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP
2010-06-07 23:50:43 +00:00
:value: 6
2012-11-22 08:22:46 +00:00
2012-11-28 01:14:11 +00:00
-----------------
2012-11-22 08:22:46 +00:00
Steering Actuator
2012-11-28 01:14:11 +00:00
-----------------
2012-11-22 08:22:46 +00:00
.. _logic-steering-actuator:
See :class: `bge.types.KX_SteeringActuator.behavior`
.. data :: KX_STEERING_SEEK
:value: 1
.. data :: KX_STEERING_FLEE
:value: 2
.. data :: KX_STEERING_PATHFOLLOWING
:value: 3
2010-06-07 23:50:43 +00:00
2010-06-02 22:56:08 +00:00
=======
Various
=======
2010-05-17 19:52:25 +00:00
---------
2D Filter
---------
.. data :: RAS_2DFILTER_BLUR
2010-06-07 23:50:43 +00:00
:value: 2
2010-05-17 19:52:25 +00:00
.. data :: RAS_2DFILTER_CUSTOMFILTER
2010-06-07 23:50:43 +00:00
Customer filter, the code code is set via shaderText property.
:value: 12
2010-05-17 19:52:25 +00:00
.. data :: RAS_2DFILTER_DILATION
2010-06-07 23:50:43 +00:00
:value: 4
2010-05-17 19:52:25 +00:00
.. data :: RAS_2DFILTER_DISABLED
2010-06-07 23:50:43 +00:00
Disable the filter that is currently active
:value: -1
2010-05-17 19:52:25 +00:00
.. data :: RAS_2DFILTER_ENABLED
2010-06-07 23:50:43 +00:00
Enable the filter that was previously disabled
:value: -2
2010-05-17 19:52:25 +00:00
.. data :: RAS_2DFILTER_EROSION
2010-06-07 23:50:43 +00:00
:value: 5
2010-05-17 19:52:25 +00:00
.. data :: RAS_2DFILTER_GRAYSCALE
2010-06-07 23:50:43 +00:00
:value: 9
2010-05-17 19:52:25 +00:00
.. data :: RAS_2DFILTER_INVERT
2010-06-07 23:50:43 +00:00
:value: 11
2010-05-17 19:52:25 +00:00
.. data :: RAS_2DFILTER_LAPLACIAN
2010-06-07 23:50:43 +00:00
:value: 6
2010-05-17 19:52:25 +00:00
.. data :: RAS_2DFILTER_MOTIONBLUR
2010-06-07 23:50:43 +00:00
Create and enable preset filters
:value: 1
2010-05-17 19:52:25 +00:00
.. data :: RAS_2DFILTER_NOFILTER
2010-06-07 23:50:43 +00:00
Disable and destroy the filter that is currently active
:value: 0
2010-05-17 19:52:25 +00:00
.. data :: RAS_2DFILTER_PREWITT
2010-06-07 23:50:43 +00:00
:value: 8
2010-05-17 19:52:25 +00:00
.. data :: RAS_2DFILTER_SEPIA
2010-06-07 23:50:43 +00:00
:value: 10
2010-05-17 19:52:25 +00:00
.. data :: RAS_2DFILTER_SHARPEN
2010-06-07 23:50:43 +00:00
:value: 3
2010-05-17 19:52:25 +00:00
.. data :: RAS_2DFILTER_SOBEL
2010-06-07 23:50:43 +00:00
:value: 7
2012-11-22 08:07:13 +00:00
2012-11-22 08:16:30 +00:00
----------------
Armature Channel
----------------
.. _armaturechannel-constants-rotation-mode:
2012-11-22 09:12:21 +00:00
See :class: `bge.types.BL_ArmatureChannel.rotation_mode`
2012-11-22 08:16:30 +00:00
2012-11-22 09:12:21 +00:00
.. note:
euler mode are named as in Blender UI but the actual axis order is reversed
2012-11-22 08:30:54 +00:00
2012-11-22 09:20:36 +00:00
.. data :: ROT_MODE_QUAT
2012-11-22 08:16:30 +00:00
2012-11-22 09:12:21 +00:00
Use quaternion in rotation attribute to update bone rotation.
2012-11-22 08:30:54 +00:00
2012-11-22 09:12:21 +00:00
:value: 0
2012-11-22 08:16:30 +00:00
2012-11-22 09:20:36 +00:00
.. data :: ROT_MODE_XYZ
2012-11-22 08:30:54 +00:00
2012-11-22 09:12:21 +00:00
Use euler_rotation and apply angles on bone's Z, Y, X axis successively.
2012-11-22 08:16:30 +00:00
2012-11-22 09:12:21 +00:00
:value: 1
2012-11-22 08:30:54 +00:00
2012-11-22 09:20:36 +00:00
.. data :: ROT_MODE_XZY
2012-11-22 08:16:30 +00:00
2012-11-22 09:12:21 +00:00
Use euler_rotation and apply angles on bone's Y, Z, X axis successively.
2012-11-22 08:30:54 +00:00
2012-11-22 09:12:21 +00:00
:value: 2
2012-11-22 08:16:30 +00:00
2012-11-22 09:20:36 +00:00
.. data :: ROT_MODE_YXZ
2012-11-22 08:30:54 +00:00
2012-11-22 09:12:21 +00:00
Use euler_rotation and apply angles on bone's Z, X, Y axis successively.
2012-11-22 08:16:30 +00:00
2012-11-22 09:12:21 +00:00
:value: 3
2012-11-22 08:30:54 +00:00
2012-11-22 09:20:36 +00:00
.. data :: ROT_MODE_YZX
2012-11-22 08:16:30 +00:00
2012-11-22 09:12:21 +00:00
Use euler_rotation and apply angles on bone's X, Z, Y axis successively.
2012-11-22 08:16:30 +00:00
2012-11-22 09:12:21 +00:00
:value: 4
2012-11-22 08:07:13 +00:00
2012-11-22 09:20:36 +00:00
.. data :: ROT_MODE_ZXY
2012-11-22 08:07:13 +00:00
2012-11-22 09:12:21 +00:00
Use euler_rotation and apply angles on bone's Y, X, Z axis successively.
2012-11-22 08:07:13 +00:00
2012-11-22 09:12:21 +00:00
:value: 5
2012-11-22 08:07:13 +00:00
2012-11-22 09:20:36 +00:00
.. data :: ROT_MODE_ZYX
2012-11-22 08:07:13 +00:00
2012-11-22 09:12:21 +00:00
Use euler_rotation and apply angles on bone's X, Y, Z axis successively.
2012-11-22 08:07:13 +00:00
2012-11-22 09:12:21 +00:00
:value: 6
2012-11-22 08:07:13 +00:00
2012-11-28 01:14:11 +00:00
-------------------
2012-11-22 09:12:21 +00:00
Armature Constraint
2012-11-28 01:14:11 +00:00
-------------------
2012-11-22 09:12:21 +00:00
.. _armatureconstraint-constants-type:
See :class: `bge.types.BL_ArmatureConstraint.type`
.. data :: CONSTRAINT_TYPE_TRACKTO
.. data :: CONSTRAINT_TYPE_KINEMATIC
.. data :: CONSTRAINT_TYPE_ROTLIKE
.. data :: CONSTRAINT_TYPE_LOCLIKE
.. data :: CONSTRAINT_TYPE_MINMAX
.. data :: CONSTRAINT_TYPE_SIZELIKE
.. data :: CONSTRAINT_TYPE_LOCKTRACK
.. data :: CONSTRAINT_TYPE_STRETCHTO
.. data :: CONSTRAINT_TYPE_CLAMPTO
.. data :: CONSTRAINT_TYPE_TRANSFORM
.. data :: CONSTRAINT_TYPE_DISTLIMIT
.. _armatureconstraint-constants-ik-type:
See :class: `bge.types.BL_ArmatureConstraint.ik_type`
.. data :: CONSTRAINT_IK_COPYPOSE
2012-11-22 21:37:12 +00:00
constraint is trying to match the position and eventually the rotation of the target.
:value: 0
2012-11-22 09:12:21 +00:00
.. data :: CONSTRAINT_IK_DISTANCE
2012-11-22 21:37:12 +00:00
Constraint is maintaining a certain distance to target subject to ik_mode
:value: 1
2012-11-22 09:12:21 +00:00
.. _armatureconstraint-constants-ik-flag:
See :class: `bge.types.BL_ArmatureConstraint.ik_flag`
.. data :: CONSTRAINT_IK_FLAG_TIP
2012-11-22 21:37:12 +00:00
Set when the constraint operates on the head of the bone and not the tail
:value: 1
2012-11-22 09:12:21 +00:00
.. data :: CONSTRAINT_IK_FLAG_ROT
2012-11-22 21:37:12 +00:00
Set when the constraint tries to match the orientation of the target
:value: 2
2012-11-22 09:12:21 +00:00
.. data :: CONSTRAINT_IK_FLAG_STRETCH
2012-11-22 21:37:12 +00:00
Set when the armature is allowed to stretch (only the bones with stretch factor > 0.0)
:value: 16
2012-11-22 09:12:21 +00:00
.. data :: CONSTRAINT_IK_FLAG_POS
2012-11-22 21:37:12 +00:00
Set when the constraint tries to match the position of the target.
:value: 32
2012-11-22 09:12:21 +00:00
.. _armatureconstraint-constants-ik-mode:
See :class: `bge.types.BL_ArmatureConstraint.ik_mode`
.. data :: CONSTRAINT_IK_MODE_INSIDE
2012-11-22 21:37:12 +00:00
The constraint tries to keep the bone within ik_dist of target
:value: 0
2012-11-22 09:12:21 +00:00
.. data :: CONSTRAINT_IK_MODE_OUTSIDE
2012-11-22 21:37:12 +00:00
The constraint tries to keep the bone outside ik_dist of the target
:value: 1
2012-11-22 09:12:21 +00:00
.. data :: CONSTRAINT_IK_MODE_ONSURFACE
2012-11-22 21:37:12 +00:00
The constraint tries to keep the bone exactly at ik_dist of the target.
:value: 2
.. _input-status:
----------------
Blender Material
----------------
.. data :: BL_DST_ALPHA
.. data :: BL_DST_COLOR
.. data :: BL_ONE
.. data :: BL_ONE_MINUS_DST_ALPHA
.. data :: BL_ONE_MINUS_DST_COLOR
.. data :: BL_ONE_MINUS_SRC_ALPHA
.. data :: BL_ONE_MINUS_SRC_COLOR
.. data :: BL_SRC_ALPHA
.. data :: BL_SRC_ALPHA_SATURATE
.. data :: BL_SRC_COLOR
.. data :: BL_ZERO
------------
Input Status
------------
See :class: `bge.types.SCA_PythonKeyboard` , :class: `bge.types.SCA_PythonMouse` , :class: `bge.types.SCA_MouseSensor` , :class: `bge.types.SCA_KeyboardSensor`
.. data :: KX_INPUT_NONE
.. data :: KX_INPUT_JUST_ACTIVATED
.. data :: KX_INPUT_ACTIVE
.. data :: KX_INPUT_JUST_RELEASED
2012-11-28 01:14:11 +00:00
-------------
2012-11-22 21:52:30 +00:00
KX_GameObject
2012-11-28 01:14:11 +00:00
-------------
2012-11-22 21:52:30 +00:00
.. _gameobject-playaction-mode:
See :class: `bge.types.KX_GameObject.playAction`
.. data :: KX_ACTION_MODE_PLAY
Play the action once.
:value: 0
.. data :: KX_ACTION_MODE_LOOP
Loop the action (repeat it).
:value: 1
.. data :: KX_ACTION_MODE_PING_PONG
Play the action one direct then back the other way when it has completed.
:value: 2
2013-08-14 23:31:49 +00:00
.. _gameobject-playaction-blend:
.. data :: KX_ACTION_BLEND_BLEND
Blend layers using linear interpolation
:value: 0
.. data :: KX_ACTION_BLEND_ADD
Adds the layers together
:value: 1
2012-11-22 21:52:30 +00:00
2012-11-22 21:37:12 +00:00
-------------
Mouse Buttons
-------------
See :class: `bge.types.SCA_MouseSensor`
.. data :: KX_MOUSE_BUT_LEFT
.. data :: KX_MOUSE_BUT_MIDDLE
.. data :: KX_MOUSE_BUT_RIGHT
2012-11-28 01:14:11 +00:00
--------------------------
2012-11-22 21:37:12 +00:00
Navigation Mesh Draw Modes
2012-11-28 01:14:11 +00:00
--------------------------
2012-11-22 21:37:12 +00:00
.. _navmesh-draw-mode:
.. data :: RM_WALLS
Draw only the walls.
.. data :: RM_POLYS
Draw only polygons.
.. data :: RM_TRIS
Draw triangle mesh.
------
Shader
------
.. data :: VIEWMATRIX
.. data :: VIEWMATRIX_INVERSE
.. data :: VIEWMATRIX_INVERSETRANSPOSE
.. data :: VIEWMATRIX_TRANSPOSE
.. data :: MODELMATRIX
.. data :: MODELMATRIX_INVERSE
.. data :: MODELMATRIX_INVERSETRANSPOSE
.. data :: MODELMATRIX_TRANSPOSE
.. data :: MODELVIEWMATRIX
.. data :: MODELVIEWMATRIX_INVERSE
.. data :: MODELVIEWMATRIX_INVERSETRANSPOSE
.. data :: MODELVIEWMATRIX_TRANSPOSE
.. data :: CAM_POS
Current camera position
.. data :: CONSTANT_TIMER
User a timer for the uniform value.
.. data :: SHD_TANGENT
------
States
------
See :class: `bge.types.KX_StateActuator`
.. data :: KX_STATE1
.. data :: KX_STATE2
.. data :: KX_STATE3
.. data :: KX_STATE4
.. data :: KX_STATE5
.. data :: KX_STATE6
.. data :: KX_STATE7
.. data :: KX_STATE8
.. data :: KX_STATE9
.. data :: KX_STATE10
.. data :: KX_STATE11
.. data :: KX_STATE12
.. data :: KX_STATE13
.. data :: KX_STATE14
.. data :: KX_STATE15
.. data :: KX_STATE16
.. data :: KX_STATE17
.. data :: KX_STATE18
.. data :: KX_STATE19
.. data :: KX_STATE20
.. data :: KX_STATE21
.. data :: KX_STATE22
.. data :: KX_STATE23
.. data :: KX_STATE24
.. data :: KX_STATE25
.. data :: KX_STATE26
.. data :: KX_STATE27
.. data :: KX_STATE28
.. data :: KX_STATE29
.. data :: KX_STATE30
.. _state-actuator-operation:
See :class: `bge.types.KX_StateActuator.operation`
.. data :: KX_STATE_OP_CLR
Substract bits to state mask
2012-11-28 01:14:11 +00:00
2012-11-22 21:37:12 +00:00
:value: 0
.. data :: KX_STATE_OP_CPY
Copy state mask
2012-11-28 01:14:11 +00:00
2012-11-22 21:37:12 +00:00
:value: 1
.. data :: KX_STATE_OP_NEG
Invert bits to state mask
2012-11-28 01:14:11 +00:00
2012-11-22 21:37:12 +00:00
:value: 2
2012-11-28 01:14:11 +00:00
2012-11-22 21:37:12 +00:00
.. data :: KX_STATE_OP_SET
Add bits to state mask
2012-11-28 01:14:11 +00:00
2012-11-22 21:37:12 +00:00
:value: 3
2012-11-28 01:14:11 +00:00
2012-11-22 21:37:12 +00:00
.. _Two-D-FilterActuator-mode: