Game Logic (bge.logic)¶
Introduction¶
Module to access logic functions, imported automatically into the python controllers namespace.
# 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
KX_GameObject
, KX_Camera
or KX_LightObject
methods are
available depending on the type of object. See object types
for more reference.
# 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 available sensors reference for available attributes.
You can also access actuators linked to the controller
# To get an actuator attached to the controller:
# +--------+ +-------------------------+
# + Python +--+ Actuator "actuatorname" |
# +--------+ +-------------------------+
actuator = co.actuators["actuatorname"]
# Activate an actuator
controller.activate(actuator)
See the available actuators reference for available attributes.
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 KX_Scene
# 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
KX_Camera
has some examples using matrices.
Variables¶
- bge.logic.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.
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.
- bge.logic.keyboard¶
The current keyboard wrapped in an
SCA_PythonKeyboard
object.
- bge.logic.mouse¶
The current mouse wrapped in an
SCA_PythonMouse
object.
- bge.logic.joysticks¶
A list of attached
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.
General functions¶
- bge.logic.getCurrentController()¶
Gets the Python controller associated with this Python script.
- Return type
- bge.logic.getSceneList()¶
Gets a list of the current scenes loaded in the game engine.
- Return type
list of
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.
- bge.logic.getInactiveSceneNames()¶
Gets a list of the scene’s names not loaded in the game engine.
- Return type
list of string
- bge.logic.loadGlobalDict()¶
Loads bge.logic.globalDict from a file.
- bge.logic.saveGlobalDict()¶
Saves bge.logic.globalDict to a file.
- bge.logic.startGame(blend)¶
Loads the blend file.
- Parameters
blend (string) – The name of the blend file
- bge.logic.endGame()¶
Ends the current game.
- bge.logic.restartGame()¶
Restarts the current game by reloading the .blend file (the last saved version, not what is currently running).
- bge.logic.LibLoad(blend, type, data, load_actions=False, verbose=False, load_scripts=True, async=False, scene=None)¶
Converts the all of the datablocks of the given type from the given blend.
- Parameters
blend (string) – The path to the blend file (or the name to use for the library if data is supplied)
type (string) – The datablock type (currently only “Action”, “Mesh” and “Scene” are supported)
data (bytes) – Binary data from a blend file (optional)
load_actions (bool) – Search for and load all actions in a given Scene and not just the “active” actions (Scene type only)
verbose (bool) – Whether or not to print debugging information (e.g., “SceneName: Scene”)
load_scripts (bool) – Whether or not to load text datablocks as well (can be disabled for some extra security)
async (bool) – Whether or not to do the loading asynchronously (in another thread). Only the “Scene” type is currently supported for this feature.
scene (
KX_Scene
or string) – Scene to merge loaded data to, if None use the current scene.
- Return type
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.
- bge.logic.LibNew(name, type, data)¶
Uses existing datablock data and loads in as a new library.
- Parameters
name (string) – A unique library name used for removal later
type (string) – The datablock type (currently only “Mesh” is supported)
data (list of strings) – A list of names of the datablocks to load
- bge.logic.LibFree(name)¶
Frees a library, removing all objects and meshes from the currently active scenes.
- Parameters
name (string) – The name of the library to free (the name used in LibNew)
- bge.logic.LibList()¶
Returns a list of currently loaded libraries.
- Return type
list [str]
- bge.logic.addScene(name, overlay=1)¶
Loads a scene into the game engine.
Note
This function is not effective immediately, the scene is queued and added on the next logic cycle where it will be available from getSceneList
- Parameters
name (string) – The name of the scene
overlay (integer) – Overlay or underlay (optional)
- bge.logic.sendMessage(subject, body='', to='', message_from='')¶
Sends a message to sensors in any active scene.
- Parameters
subject (string) – The subject of the message
body (string) – The body of the message (optional)
to (string) – The name of the object to send the message to (optional)
message_from (string) – The name of the object that the message is coming from (optional)
- bge.logic.setGravity(gravity)¶
Sets the world gravity.
- Parameters
gravity (Vector((fx, fy, fz))) – gravity vector
- bge.logic.getSpectrum() (Deprecated)¶
Returns a 512 point list from the sound card. This only works if the fmod sound driver is being used.
- Return type
list [float], len(getSpectrum()) == 512
- bge.logic.getMaxLogicFrame()¶
Gets the maximum number of logic frames per render frame.
- Returns
The maximum number of logic frames per render frame
- Return type
integer
- bge.logic.setMaxLogicFrame(maxlogic)¶
Sets the maximum number of logic frames that are executed per render frame. This does not affect the physic system that still runs at full frame rate.
- Parameters
maxlogic (integer) – The new maximum number of logic frames per render frame. Valid values: 1..5
- bge.logic.getMaxPhysicsFrame()¶
Gets the maximum number of physics frames per render frame.
- Returns
The maximum number of physics frames per render frame
- Return type
integer
- bge.logic.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.
- Parameters
maxphysics (integer) – The new maximum number of physics timestep per render frame. Valid values: 1..5.
- bge.logic.getLogicTicRate()¶
Gets the logic update frequency.
- Returns
The logic frequency in Hz
- Return type
float
- bge.logic.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.
- Parameters
ticrate (float) – The new logic update frequency (in Hz).
- bge.logic.getPhysicsTicRate()¶
Gets the physics update frequency
- Returns
The physics update frequency in Hz
- Return type
float
- bge.logic.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.
- Parameters
ticrate (float) – The new update frequency (in Hz).
- bge.logic.getExitKey()¶
Gets the key used to exit the game engine
- Returns
The key (defaults to
bge.events.ESCKEY
)- Return type
int
- bge.logic.setExitKey(key)¶
Sets the key used to exit the game engine
- Parameters
key (int) – A key constant from
bge.events
- bge.logic.NextFrame()¶
Render next frame (if Python has control)
- bge.logic.setRender(render)¶
Sets the global flag that controls the render of the scene. If True, the render is done after the logic frame. If False, the render is skipped and another logic frame starts immediately.
Note
GPU VSync no longer limits the number of frame per second when render is off, but the Use Frame Rate option still regulates the fps. To run as many frames as possible, untick this option (Render Properties, System panel).
- Parameters
render (bool) – the render flag
- bge.logic.getRender()¶
Get the current value of the global render flag
- Returns
The flag value
- Return type
bool
Utility functions¶
- bge.logic.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; 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.
- Parameters
path (string) – The path string to be converted/expanded.
- Returns
The converted string
- Return type
string
- bge.logic.getAverageFrameRate()¶
Gets the estimated/average framerate for all the active scenes, not only the current scene.
- Returns
The estimated average framerate in frames per second
- Return type
float
- bge.logic.getBlendFileList(path='//')¶
Returns a list of blend files in the same directory as the open blend file, or from using the option argument.
- Parameters
path (string) – Optional directory argument, will be expanded (like expandPath) into the full path.
- Returns
A list of filenames, with no directory prefix
- Return type
list
- bge.logic.getRandomFloat()¶
Returns a random floating point value in the range [0 - 1]
- bge.logic.PrintGLInfo()¶
Prints GL Extension Info into the console
- bge.logic.PrintMemInfo()¶
Prints engine statistics into the console
- bge.logic.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.
Constants¶
- bge.logic.KX_TRUE¶
True value used by some modules.
- Value
1
- bge.logic.KX_FALSE¶
False value used by some modules.
- Value
2
Sensors¶
Sensor Status¶
- bge.logic.KX_SENSOR_INACTIVE¶
- Value
0
- bge.logic.KX_SENSOR_JUST_ACTIVATED¶
- Value
1
- bge.logic.KX_SENSOR_ACTIVE¶
- Value
2
- bge.logic.KX_SENSOR_JUST_DEACTIVATED¶
- Value
3
Armature Sensor¶
- bge.logic.KX_ARMSENSOR_STATE_CHANGED¶
Detect that the constraint is changing state (active/inactive).
- Value
0
- bge.logic.KX_ARMSENSOR_LIN_ERROR_BELOW¶
Detect that the constraint linear error is above a threshold.
- Value
1
- bge.logic.KX_ARMSENSOR_LIN_ERROR_ABOVE¶
Detect that the constraint linear error is below a threshold.
- Value
2
- bge.logic.KX_ARMSENSOR_ROT_ERROR_BELOW¶
Detect that the constraint rotation error is above a threshold.
- Value
3
- bge.logic.KX_ARMSENSOR_ROT_ERROR_ABOVE¶
Detect that the constraint rotation error is below a threshold.
- Value
4
Movement Sensor¶
- bge.logic.KX_MOVEMENT_ALL_AXIS¶
- Value
6
- bge.logic.KX_MOVEMENT_AXIS_NEG_X¶
- Value
3
- bge.logic.KX_MOVEMENT_AXIS_NEG_Y¶
- Value
4
- bge.logic.KX_MOVEMENT_AXIS_NEG_Z¶
- Value
5
- bge.logic.KX_MOVEMENT_AXIS_POS_X¶
- Value
1
- bge.logic.KX_MOVEMENT_AXIS_POS_Y¶
- Value
0
- bge.logic.KX_MOVEMENT_AXIS_POS_Z¶
- Value
2
Property Sensor¶
- bge.logic.KX_PROPSENSOR_EQUAL¶
Activate when the property is equal to the sensor value.
- Value
1
- bge.logic.KX_PROPSENSOR_NOTEQUAL¶
Activate when the property is not equal to the sensor value.
- Value
2
- bge.logic.KX_PROPSENSOR_INTERVAL¶
Activate when the property is between the specified limits.
- Value
3
- bge.logic.KX_PROPSENSOR_CHANGED¶
Activate when the property changes.
- Value
4
- bge.logic.KX_PROPSENSOR_EXPRESSION¶
Activate when the expression matches.
- Value
5
- bge.logic.KX_PROPSENSOR_LESSTHAN¶
Activate when the property is less than the sensor value.
- Value
6
- bge.logic.KX_PROPSENSOR_GREATERTHAN¶
Activate when the property is greater than the sensor value.
- Value
7
Actuators¶
Action Actuator¶
- bge.logic.KX_ACTIONACT_PLAY¶
- Value
0
- bge.logic.KX_ACTIONACT_PINGPONG¶
- Value
1
- bge.logic.KX_ACTIONACT_FLIPPER¶
- Value
2
- bge.logic.KX_ACTIONACT_LOOPSTOP¶
- Value
3
- bge.logic.KX_ACTIONACT_LOOPEND¶
- Value
4
- bge.logic.KX_ACTIONACT_PROPERTY¶
- Value
6
Armature Actuator¶
- bge.logic.KX_ACT_ARMATURE_RUN¶
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
- bge.logic.KX_ACT_ARMATURE_ENABLE¶
Enable the constraint.
- Value
1
- bge.logic.KX_ACT_ARMATURE_DISABLE¶
Disable the constraint (runtime constraint values are not updated).
- Value
2
- bge.logic.KX_ACT_ARMATURE_SETTARGET¶
Change target and subtarget of constraint.
- Value
3
- bge.logic.KX_ACT_ARMATURE_SETWEIGHT¶
Change weight of constraint (IK only).
- Value
4
- bge.logic.KX_ACT_ARMATURE_SETINFLUENCE¶
Change influence of constraint.
- Value
5
Constraint Actuator¶
See KX_ConstraintActuator.option
Applicable to Distance constraint:
- bge.logic.KX_CONSTRAINTACT_NORMAL¶
Activate alignment to surface.
- Value
64
- bge.logic.KX_CONSTRAINTACT_DISTANCE¶
Activate distance control.
- Value
512
- bge.logic.KX_CONSTRAINTACT_LOCAL¶
Direction of the ray is along the local axis.
- Value
1024
Applicable to Force field constraint:
- bge.logic.KX_CONSTRAINTACT_DOROTFH¶
Force field act on rotation as well.
- Value
2048
Applicable to both:
- bge.logic.KX_CONSTRAINTACT_MATERIAL¶
Detect material rather than property.
- Value
128
- bge.logic.KX_CONSTRAINTACT_PERMANENT¶
No deactivation if ray does not hit target.
- Value
256
See KX_ConstraintActuator.limit
- bge.logic.KX_CONSTRAINTACT_LOCX¶
Limit X coord.
- Value
1
- bge.logic.KX_CONSTRAINTACT_LOCY¶
Limit Y coord.
- Value
2
- bge.logic.KX_CONSTRAINTACT_LOCZ¶
Limit Z coord.
- Value
3
- bge.logic.KX_CONSTRAINTACT_ROTX¶
Limit X rotation.
- Value
4
- bge.logic.KX_CONSTRAINTACT_ROTY¶
Limit Y rotation.
- Value
5
- bge.logic.KX_CONSTRAINTACT_ROTZ¶
Limit Z rotation.
- Value
6
- bge.logic.KX_CONSTRAINTACT_DIRNX¶
Set distance along negative X axis.
- Value
10
- bge.logic.KX_CONSTRAINTACT_DIRNY¶
Set distance along negative Y axis.
- Value
11
- bge.logic.KX_CONSTRAINTACT_DIRNZ¶
Set distance along negative Z axis.
- Value
12
- bge.logic.KX_CONSTRAINTACT_DIRPX¶
Set distance along positive X axis.
- Value
7
- bge.logic.KX_CONSTRAINTACT_DIRPY¶
Set distance along positive Y axis.
- Value
8
- bge.logic.KX_CONSTRAINTACT_DIRPZ¶
Set distance along positive Z axis.
- Value
9
- bge.logic.KX_CONSTRAINTACT_ORIX¶
Set orientation of X axis.
- Value
13
- bge.logic.KX_CONSTRAINTACT_ORIY¶
Set orientation of Y axis.
- Value
14
- bge.logic.KX_CONSTRAINTACT_ORIZ¶
Set orientation of Z axis.
- Value
15
- bge.logic.KX_CONSTRAINTACT_FHNX¶
Set force field along negative X axis.
- Value
19
- bge.logic.KX_CONSTRAINTACT_FHNY¶
Set force field along negative Y axis.
- Value
20
- bge.logic.KX_CONSTRAINTACT_FHNZ¶
Set force field along negative Z axis.
- Value
21
- bge.logic.KX_CONSTRAINTACT_FHPX¶
Set force field along positive X axis.
- Value
16
- bge.logic.KX_CONSTRAINTACT_FHPY¶
Set force field along positive Y axis.
- Value
17
- bge.logic.KX_CONSTRAINTACT_FHPZ¶
Set force field along positive Z axis.
- Value
18
Dynamic Actuator¶
- bge.logic.KX_DYN_RESTORE_DYNAMICS¶
- Value
0
- bge.logic.KX_DYN_DISABLE_DYNAMICS¶
- Value
1
- bge.logic.KX_DYN_ENABLE_RIGID_BODY¶
- Value
2
- bge.logic.KX_DYN_DISABLE_RIGID_BODY¶
- Value
3
- bge.logic.KX_DYN_SET_MASS¶
- Value
4
Game Actuator¶
See KX_GameActuator
- bge.logic.KX_GAME_LOAD¶
- Value
1
- bge.logic.KX_GAME_START¶
- Value
2
- bge.logic.KX_GAME_RESTART¶
- Value
3
- bge.logic.KX_GAME_QUIT¶
- Value
4
- bge.logic.KX_GAME_SAVECFG¶
- Value
5
- bge.logic.KX_GAME_LOADCFG¶
- Value
6
Mouse Actuator¶
See KX_MouseActuator
- bge.logic.KX_ACT_MOUSE_OBJECT_AXIS_X¶
- Value
0
- bge.logic.KX_ACT_MOUSE_OBJECT_AXIS_Y¶
- Value
1
- bge.logic.KX_ACT_MOUSE_OBJECT_AXIS_Z¶
- Value
2
Random Distributions¶
- bge.logic.KX_RANDOMACT_BOOL_CONST¶
- Value
1
- bge.logic.KX_RANDOMACT_BOOL_UNIFORM¶
- Value
2
- bge.logic.KX_RANDOMACT_BOOL_BERNOUILLI¶
- Value
3
- bge.logic.KX_RANDOMACT_INT_CONST¶
- Value
4
- bge.logic.KX_RANDOMACT_INT_UNIFORM¶
- Value
5
- bge.logic.KX_RANDOMACT_INT_POISSON¶
- Value
6
- bge.logic.KX_RANDOMACT_FLOAT_CONST¶
- Value
7
- bge.logic.KX_RANDOMACT_FLOAT_UNIFORM¶
- Value
8
- bge.logic.KX_RANDOMACT_FLOAT_NORMAL¶
- Value
9
- bge.logic.KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL¶
- Value
10
Scene Actuator¶
See KX_SceneActuator
- bge.logic.KX_SCENE_RESTART¶
- Value
1
- bge.logic.KX_SCENE_SET_SCENE¶
- Value
2
- bge.logic.KX_SCENE_SET_CAMERA¶
- Value
3
- bge.logic.KX_SCENE_ADD_FRONT_SCENE¶
- Value
4
- bge.logic.KX_SCENE_ADD_BACK_SCENE¶
- Value
5
- bge.logic.KX_SCENE_REMOVE_SCENE¶
- Value
6
- bge.logic.KX_SCENE_SUSPEND¶
- Value
7
- bge.logic.KX_SCENE_RESUME¶
- Value
8
Sound Actuator¶
See KX_SoundActuator
- bge.logic.KX_SOUNDACT_PLAYSTOP¶
- Value
1
- bge.logic.KX_SOUNDACT_PLAYEND¶
- Value
2
- bge.logic.KX_SOUNDACT_LOOPSTOP¶
- Value
3
- bge.logic.KX_SOUNDACT_LOOPEND¶
- Value
4
- bge.logic.KX_SOUNDACT_LOOPBIDIRECTIONAL¶
- Value
5
- bge.logic.KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP¶
- Value
6
Steering Actuator¶
See KX_SteeringActuator.behavior
- bge.logic.KX_STEERING_SEEK¶
- Value
1
- bge.logic.KX_STEERING_FLEE¶
- Value
2
- bge.logic.KX_STEERING_PATHFOLLOWING¶
- Value
3
TrackTo Actuator¶
- bge.logic.KX_TRACK_UPAXIS_POS_X¶
- Value
0
- bge.logic.KX_TRACK_UPAXIS_POS_Y¶
- Value
1
- bge.logic.KX_TRACK_UPAXIS_POS_Z¶
- Value
2
- bge.logic.KX_TRACK_TRAXIS_POS_X¶
- Value
0
- bge.logic.KX_TRACK_TRAXIS_POS_Y¶
- Value
1
- bge.logic.KX_TRACK_TRAXIS_POS_Z¶
- Value
2
- bge.logic.KX_TRACK_TRAXIS_NEG_X¶
- Value
3
- bge.logic.KX_TRACK_TRAXIS_NEG_Y¶
- Value
4
- bge.logic.KX_TRACK_TRAXIS_NEG_Z¶
- Value
5
Various¶
2D Filter¶
See KX_2DFilterActuator.mode
- bge.logic.RAS_2DFILTER_BLUR¶
- Value
2
- bge.logic.RAS_2DFILTER_CUSTOMFILTER¶
Customer filter, the code code is set via shaderText property.
- Value
12
- bge.logic.RAS_2DFILTER_DILATION¶
- Value
4
- bge.logic.RAS_2DFILTER_DISABLED¶
Disable the filter that is currently active.
- Value
-1
- bge.logic.RAS_2DFILTER_ENABLED¶
Enable the filter that was previously disabled.
- Value
-2
- bge.logic.RAS_2DFILTER_EROSION¶
- Value
5
- bge.logic.RAS_2DFILTER_GRAYSCALE¶
- Value
9
- bge.logic.RAS_2DFILTER_INVERT¶
- Value
11
- bge.logic.RAS_2DFILTER_LAPLACIAN¶
- Value
6
- bge.logic.RAS_2DFILTER_MOTIONBLUR¶
Create and enable preset filters.
- Value
1
- bge.logic.RAS_2DFILTER_NOFILTER¶
Disable and destroy the filter that is currently active.
- Value
0
- bge.logic.RAS_2DFILTER_PREWITT¶
- Value
8
- bge.logic.RAS_2DFILTER_SEPIA¶
- Value
10
- bge.logic.RAS_2DFILTER_SHARPEN¶
- Value
3
- bge.logic.RAS_2DFILTER_SOBEL¶
- Value
7
Armature Channel¶
See BL_ArmatureChannel.rotation_mode
- bge.logic.ROT_MODE_QUAT¶
Use quaternion in rotation attribute to update bone rotation.
- Value
0
- bge.logic.ROT_MODE_XYZ¶
Use euler_rotation and apply angles on bone’s Z, Y, X axis successively.
- Value
1
- bge.logic.ROT_MODE_XZY¶
Use euler_rotation and apply angles on bone’s Y, Z, X axis successively.
- Value
2
- bge.logic.ROT_MODE_YXZ¶
Use euler_rotation and apply angles on bone’s Z, X, Y axis successively.
- Value
3
- bge.logic.ROT_MODE_YZX¶
Use euler_rotation and apply angles on bone’s X, Z, Y axis successively.
- Value
4
- bge.logic.ROT_MODE_ZXY¶
Use euler_rotation and apply angles on bone’s Y, X, Z axis successively.
- Value
5
- bge.logic.ROT_MODE_ZYX¶
Use euler_rotation and apply angles on bone’s X, Y, Z axis successively.
- Value
6
Armature Constraint¶
See BL_ArmatureConstraint.type
- bge.logic.CONSTRAINT_TYPE_TRACKTO¶
- Value
2
- bge.logic.CONSTRAINT_TYPE_KINEMATIC¶
- Value
3
- bge.logic.CONSTRAINT_TYPE_ROTLIKE¶
- Value
8
- bge.logic.CONSTRAINT_TYPE_LOCLIKE¶
- Value
9
- bge.logic.CONSTRAINT_TYPE_MINMAX¶
- Value
16
- bge.logic.CONSTRAINT_TYPE_SIZELIKE¶
- Value
10
- bge.logic.CONSTRAINT_TYPE_LOCKTRACK¶
- Value
13
- bge.logic.CONSTRAINT_TYPE_STRETCHTO¶
- Value
15
- bge.logic.CONSTRAINT_TYPE_CLAMPTO¶
- Value
18
- bge.logic.CONSTRAINT_TYPE_TRANSFORM¶
- Value
19
- bge.logic.CONSTRAINT_TYPE_DISTLIMIT¶
- Value
14
See BL_ArmatureConstraint.ik_type
- bge.logic.CONSTRAINT_IK_COPYPOSE¶
Constraint is trying to match the position and eventually the rotation of the target.
- Value
0
- bge.logic.CONSTRAINT_IK_DISTANCE¶
Constraint is maintaining a certain distance to target subject to ik_mode.
- Value
1
See BL_ArmatureConstraint.ik_flag
- bge.logic.CONSTRAINT_IK_FLAG_TIP¶
Set when the constraint operates on the head of the bone and not the tail.
- Value
1
- bge.logic.CONSTRAINT_IK_FLAG_ROT¶
Set when the constraint tries to match the orientation of the target.
- Value
2
- bge.logic.CONSTRAINT_IK_FLAG_STRETCH¶
Set when the armature is allowed to stretch (only the bones with stretch factor > 0.0).
- Value
16
- bge.logic.CONSTRAINT_IK_FLAG_POS¶
Set when the constraint tries to match the position of the target.
- Value
32
See BL_ArmatureConstraint.ik_mode
- bge.logic.CONSTRAINT_IK_MODE_INSIDE¶
The constraint tries to keep the bone within ik_dist of target.
- Value
0
- bge.logic.CONSTRAINT_IK_MODE_OUTSIDE¶
The constraint tries to keep the bone outside ik_dist of the target.
- Value
1
- bge.logic.CONSTRAINT_IK_MODE_ONSURFACE¶
The constraint tries to keep the bone exactly at ik_dist of the target.
- Value
2
Blender Material¶
- bge.logic.BL_DST_ALPHA¶
- Value
8
- bge.logic.BL_DST_COLOR¶
- Value
4
- bge.logic.BL_ONE¶
- Value
1
- bge.logic.BL_ONE_MINUS_DST_ALPHA¶
- Value
9
- bge.logic.BL_ONE_MINUS_DST_COLOR¶
- Value
5
- bge.logic.BL_ONE_MINUS_SRC_ALPHA¶
- Value
7
- bge.logic.BL_ONE_MINUS_SRC_COLOR¶
- Value
3
- bge.logic.BL_SRC_ALPHA¶
- Value
6
- bge.logic.BL_SRC_ALPHA_SATURATE¶
- Value
10
- bge.logic.BL_SRC_COLOR¶
- Value
2
- bge.logic.BL_ZERO¶
- Value
0
Input Status¶
See SCA_PythonKeyboard
, SCA_PythonMouse
, SCA_MouseSensor
, SCA_KeyboardSensor
- bge.logic.KX_INPUT_NONE¶
- Value
0
- bge.logic.KX_INPUT_JUST_ACTIVATED¶
- Value
1
- bge.logic.KX_INPUT_ACTIVE¶
- Value
2
- bge.logic.KX_INPUT_JUST_RELEASED¶
- Value
3
KX_GameObject¶
- bge.logic.KX_ACTION_MODE_PLAY¶
Play the action once.
- Value
0
- bge.logic.KX_ACTION_MODE_LOOP¶
Loop the action (repeat it).
- Value
1
- bge.logic.KX_ACTION_MODE_PING_PONG¶
Play the action one direct then back the other way when it has completed.
- Value
2
- bge.logic.KX_ACTION_BLEND_BLEND¶
Blend layers using linear interpolation.
- Value
0
- bge.logic.KX_ACTION_BLEND_ADD¶
Adds the layers together.
- Value
1
Mouse Buttons¶
See SCA_MouseSensor
- bge.logic.KX_MOUSE_BUT_LEFT¶
- Value
116
- bge.logic.KX_MOUSE_BUT_MIDDLE¶
- Value
117
- bge.logic.KX_MOUSE_BUT_RIGHT¶
- Value
118
Shader¶
- bge.logic.VIEWMATRIX¶
- Value
0
- bge.logic.VIEWMATRIX_INVERSE¶
- Value
10
- bge.logic.VIEWMATRIX_INVERSETRANSPOSE¶
- Value
11
- bge.logic.VIEWMATRIX_TRANSPOSE¶
- Value
9
- bge.logic.MODELMATRIX¶
- Value
4
- bge.logic.MODELMATRIX_INVERSE¶
- Value
6
- bge.logic.MODELMATRIX_INVERSETRANSPOSE¶
- Value
7
- bge.logic.MODELMATRIX_TRANSPOSE¶
- Value
5
- bge.logic.MODELVIEWMATRIX¶
- Value
0
- bge.logic.MODELVIEWMATRIX_INVERSE¶
- Value
2
- bge.logic.MODELVIEWMATRIX_INVERSETRANSPOSE¶
- Value
3
- bge.logic.MODELVIEWMATRIX_TRANSPOSE¶
- Value
1
- bge.logic.CAM_POS¶
Current camera position
- Value
12
- bge.logic.CONSTANT_TIMER¶
- Value
13
- bge.logic.EYE¶
User a timer for the uniform value.
- Value
14
- bge.logic.SHD_TANGENT¶
- Value
1
States¶
See KX_StateActuator
- bge.logic.KX_STATE1¶
- Value
1
- bge.logic.KX_STATE2¶
- Value
2
- bge.logic.KX_STATE3¶
- Value
4
- bge.logic.KX_STATE4¶
- Value
8
- bge.logic.KX_STATE5¶
- Value
16
- bge.logic.KX_STATE6¶
- Value
32
- bge.logic.KX_STATE7¶
- Value
64
- bge.logic.KX_STATE8¶
- Value
128
- bge.logic.KX_STATE9¶
- Value
256
- bge.logic.KX_STATE10¶
- Value
512
- bge.logic.KX_STATE11¶
- Value
1024
- bge.logic.KX_STATE12¶
- Value
2048
- bge.logic.KX_STATE13¶
- Value
4096
- bge.logic.KX_STATE14¶
- Value
8192
- bge.logic.KX_STATE15¶
- Value
16384
- bge.logic.KX_STATE16¶
- Value
32768
- bge.logic.KX_STATE17¶
- Value
65536
- bge.logic.KX_STATE18¶
- Value
131072
- bge.logic.KX_STATE19¶
- Value
262144
- bge.logic.KX_STATE20¶
- Value
524288
- bge.logic.KX_STATE21¶
- Value
1048576
- bge.logic.KX_STATE22¶
- Value
2097152
- bge.logic.KX_STATE23¶
- Value
4194304
- bge.logic.KX_STATE24¶
- Value
8388608
- bge.logic.KX_STATE25¶
- Value
16777216
- bge.logic.KX_STATE26¶
- Value
33554432
- bge.logic.KX_STATE27¶
- Value
67108864
- bge.logic.KX_STATE28¶
- Value
134217728
- bge.logic.KX_STATE29¶
- Value
268435456
- bge.logic.KX_STATE30¶
- Value
536870912
See KX_StateActuator.operation
- bge.logic.KX_STATE_OP_CLR¶
Substract bits to state mask.
- Value
2
- bge.logic.KX_STATE_OP_CPY¶
Copy state mask.
- Value
0
- bge.logic.KX_STATE_OP_NEG¶
Invert bits to state mask.
- Value
3
- bge.logic.KX_STATE_OP_SET¶
Add bits to state mask.
- Value
1