Welcome to mirror list, hosted at ThFree Co, Russian Federation.

bge.logic.rst « rst « python_api « doc - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4e0d317e4bf4a808fffc31250e9353fe8fd8fa8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275

Game Logic (bge.logic)
======================

************
Introduction
************

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

: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

.. 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:

.. 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`

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

.. 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_MouseActuator`
   * :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`

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``

:class:`bge.types.KX_Camera` has some examples using matrices.

*********
Variables
*********

.. 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.

   .. 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.

.. data:: mouse

   The current mouse wrapped in an :class:`~bge.types.SCA_PythonMouse` object.

.. data:: joysticks

   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.

*****************
General functions
*****************

.. 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.

.. 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).
   
.. function:: LibLoad(blend, type, data, load_actions=False, verbose=False, load_scripts=True, async=False)
   
   Converts the all of the datablocks of the given type from the given blend.
   
   :arg blend: The path to the blend file (or the name to use for the library if data is supplied)
   :type blend: string
   :arg type: The datablock type (currently only "Action", "Mesh" and "Scene" are supported)
   :type type: string
   :arg data: Binary data from a blend file (optional)
   :type data: bytes
   :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
   :arg load_scripts: Whether or not to load text datablocks as well (can be disabled for some extra security)
   :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.
   
.. 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
   
.. function:: LibList()

   Returns a list of currently loaded libraries.
   
   :rtype: list [str]

.. function:: 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`

   :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()

   Gets the maximum number of logic frames per render frame.
   
   :return: The maximum number of logic frames per render frame
   :rtype: integer

.. function:: 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.   
    
   :arg maxlogic: The new maximum number of logic frames per render frame. Valid values: 1..5
   :type maxlogic: integer

.. function:: getMaxPhysicsFrame()

   Gets the maximum number of physics frames per render frame.
   
   :return: The maximum number of physics frames per render frame
   :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

.. 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`
   :type key: int

.. function:: NextFrame()

   Render next frame (if Python has control)

*****************
Utility functions
*****************

.. 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;
   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.

   :arg path: The path string to be converted/expanded.
   :type path: string
   :return: The converted string
   :rtype: string

.. function:: getAverageFrameRate()

   Gets the estimated/average framerate for all the active scenes, not only the current scene.

   :return: The estimated average framerate in frames per second
   :rtype: float

.. 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)

.. function:: PrintGLInfo()

   Prints GL Extension Info into the console

.. function:: PrintMemInfo()

   Prints engine statistics into the console

.. 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.
   
*********
Constants
*********

.. data:: KX_TRUE

   True value used by some modules.

.. data:: KX_FALSE

   False value used by some modules.

=======
Sensors
======= 

.. _sensor-status:

-------------
Sensor Status
-------------

.. data:: KX_SENSOR_INACTIVE
.. data:: KX_SENSOR_JUST_ACTIVATED
.. data:: KX_SENSOR_ACTIVE
.. data:: KX_SENSOR_JUST_DEACTIVATED

---------------
Armature Sensor
---------------

.. _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
  

.. _logic-property-sensor:

---------------
Property Sensor
---------------

.. data:: KX_PROPSENSOR_EQUAL

   Activate when the property is equal to the sensor value.

   :value: 1

.. data:: KX_PROPSENSOR_NOTEQUAL

   Activate when the property is not equal to the sensor value.
   
   :value: 2

.. data:: KX_PROPSENSOR_INTERVAL

   Activate when the property is between the specified limits.
   
   :value: 3
   
.. data:: KX_PROPSENSOR_CHANGED

   Activate when the property changes   

   :value: 4

.. data:: KX_PROPSENSOR_EXPRESSION

   Activate when the expression matches
   
   :value: 5

.. data:: KX_PROPSENSOR_LESSTHAN

   Activate when the property is less than the sensor value

   :value: 6

.. data:: KX_PROPSENSOR_GREATERTHAN

   Activate when the property is greater than the sensor value

   :value: 7

------------
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
=========

.. _action-actuator:

---------------
Action Actuator
---------------

See :class:`bge.types.BL_ActionActuator`

.. data:: KX_ACTIONACT_PLAY
.. data:: KX_ACTIONACT_PINGPONG
.. data:: KX_ACTIONACT_FLIPPER
.. data:: KX_ACTIONACT_LOOPSTOP
.. data:: KX_ACTIONACT_LOOPEND
.. data:: KX_ACTIONACT_PROPERTY

-----------------
Armature Actuator
-----------------

 .. _armatureactuator-constants-type:
   
See :class:`bge.types.BL_ArmatureActuator.type`

.. data:: 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

.. data:: KX_ACT_ARMATURE_ENABLE

  Enable the constraint.

  :value: 1

.. data:: KX_ACT_ARMATURE_DISABLE

  Disable the constraint (runtime constraint values are not updated).

  :value: 2

.. data:: KX_ACT_ARMATURE_SETTARGET

  Change target and subtarget of constraint.
  
  :value: 3

.. data:: KX_ACT_ARMATURE_SETWEIGHT

  Change weight of constraint (IK only).

  :value: 4

.. data:: KX_ACT_ARMATURE_SETINFLUENCE

  Change influence of constraint.

  :value: 5

-------------------
Constraint Actuator
-------------------

.. _constraint-actuator-option:

See :class:`bge.types.KX_ConstraintActuator.option`

* Applicable to Distance constraint:

.. data:: KX_CONSTRAINTACT_NORMAL

     Activate alignment to surface
   
.. data:: KX_CONSTRAINTACT_DISTANCE

     Activate distance control

.. data:: KX_CONSTRAINTACT_LOCAL

     Direction of the ray is along the local axis

* Applicable to Force field constraint:

.. data:: KX_CONSTRAINTACT_DOROTFH

     Force field act on rotation as well

* Applicable to both:

.. data:: KX_CONSTRAINTACT_MATERIAL

     Detect material rather than property
   
.. data:: KX_CONSTRAINTACT_PERMANENT

     No deactivation if ray does not hit target

.. _constraint-actuator-limit:

See :class:`bge.types.KX_ConstraintActuator.limit`

.. data:: KX_CONSTRAINTACT_LOCX

   Limit X coord.
   
.. data:: KX_CONSTRAINTACT_LOCY

   Limit Y coord

.. data:: KX_CONSTRAINTACT_LOCZ

   Limit Z coord
   
.. data:: KX_CONSTRAINTACT_ROTX

   Limit X rotation

.. data:: KX_CONSTRAINTACT_ROTY

   Limit Y rotation
   
.. data:: KX_CONSTRAINTACT_ROTZ

   Limit Z rotation
   
.. data:: KX_CONSTRAINTACT_DIRNX

   Set distance along negative X axis

.. data:: KX_CONSTRAINTACT_DIRNY

   Set distance along negative Y axis
   
.. data:: KX_CONSTRAINTACT_DIRNZ

   Set distance along negative Z axis
   
.. data:: KX_CONSTRAINTACT_DIRPX

   Set distance along positive X axis

.. data:: KX_CONSTRAINTACT_DIRPY

   Set distance along positive Y axis
   
.. data:: KX_CONSTRAINTACT_DIRPZ

   Set distance along positive Z axis
   
.. data:: KX_CONSTRAINTACT_ORIX

   Set orientation of X axis
   
.. data:: KX_CONSTRAINTACT_ORIY

   Set orientation of Y axis
   
.. data:: KX_CONSTRAINTACT_ORIZ

   Set orientation of Z axis
   
.. data:: KX_CONSTRAINTACT_FHNX

   Set force field along negative X axis
   
.. data:: KX_CONSTRAINTACT_FHNY

   Set force field along negative Y axis
   
.. data:: KX_CONSTRAINTACT_FHNZ

   Set force field along negative Z axis
   
.. data:: KX_CONSTRAINTACT_FHPX

   Set force field along positive X axis

.. data:: KX_CONSTRAINTACT_FHPY

   Set force field along positive Y axis
   
.. data:: KX_CONSTRAINTACT_FHPZ

   Set force field along positive Z axis

----------------
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

.. _game-actuator:

-------------
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

.. _mouse-actuator:

---------------
Mouse Actuator
---------------

.. data:: KX_ACT_MOUSE_OBJECT_AXIS_X
.. data:: KX_ACT_MOUSE_OBJECT_AXIS_Y
.. data:: KX_ACT_MOUSE_OBJECT_AXIS_Z

---------------
Parent Actuator
---------------

.. data:: KX_PARENT_REMOVE
.. data:: KX_PARENT_SET

.. _logic-random-distributions:

--------------------
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

--------------
Scene Actuator
--------------

See :class:`bge.types.KX_SceneActuator`

.. 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

.. _logic-sound-actuator:

--------------
Sound Actuator
--------------
      
See :class:`bge.types.KX_SoundActuator`

.. data:: KX_SOUNDACT_PLAYSTOP

   :value: 1
   
.. data:: KX_SOUNDACT_PLAYEND

   :value: 2
   
.. data:: KX_SOUNDACT_LOOPSTOP

   :value: 3
   
.. data:: KX_SOUNDACT_LOOPEND

   :value: 4
   
.. data:: KX_SOUNDACT_LOOPBIDIRECTIONAL

   :value: 5
   
.. data:: KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP

   :value: 6

-----------------
Steering Actuator
-----------------

.. _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


=======
Various
=======

---------
2D Filter
---------

.. data:: RAS_2DFILTER_BLUR

   :value: 2
   
.. data:: RAS_2DFILTER_CUSTOMFILTER

   Customer filter, the code code is set via shaderText property.
   
   :value: 12
   
.. data:: RAS_2DFILTER_DILATION

   :value: 4
   
.. data:: RAS_2DFILTER_DISABLED

   Disable the filter that is currently active

   :value: -1
   
.. data:: RAS_2DFILTER_ENABLED

   Enable the filter that was previously disabled

   :value: -2
   
.. data:: RAS_2DFILTER_EROSION

   :value: 5
   
.. data:: RAS_2DFILTER_GRAYSCALE

   :value: 9
   
.. data:: RAS_2DFILTER_INVERT

   :value: 11
   
.. data:: RAS_2DFILTER_LAPLACIAN

   :value: 6
   
.. data:: RAS_2DFILTER_MOTIONBLUR

   Create and enable preset filters

   :value: 1
   
.. data:: RAS_2DFILTER_NOFILTER

   Disable and destroy the filter that is currently active

   :value: 0
   
.. data:: RAS_2DFILTER_PREWITT

   :value: 8
   
.. data:: RAS_2DFILTER_SEPIA

   :value: 10
   
.. data:: RAS_2DFILTER_SHARPEN

   :value: 3
   
.. data:: RAS_2DFILTER_SOBEL

   :value: 7

----------------
Armature Channel
----------------
.. _armaturechannel-constants-rotation-mode:

See :class:`bge.types.BL_ArmatureChannel.rotation_mode`

.. note:
  euler mode are named as in Blender UI but the actual axis order is reversed

.. data:: ROT_MODE_QUAT

  Use quaternion in rotation attribute to update bone rotation.

  :value: 0

.. data:: ROT_MODE_XYZ

  Use euler_rotation and apply angles on bone's Z, Y, X axis successively.

  :value: 1

.. data:: ROT_MODE_XZY

  Use euler_rotation and apply angles on bone's Y, Z, X axis successively.

  :value: 2

.. data:: ROT_MODE_YXZ

  Use euler_rotation and apply angles on bone's Z, X, Y axis successively.

  :value: 3

.. data:: ROT_MODE_YZX

  Use euler_rotation and apply angles on bone's X, Z, Y axis successively.

  :value: 4

.. data:: ROT_MODE_ZXY

  Use euler_rotation and apply angles on bone's Y, X, Z axis successively.

  :value: 5

.. data:: ROT_MODE_ZYX

  Use euler_rotation and apply angles on bone's X, Y, Z axis successively.

  :value: 6


-------------------
Armature Constraint
-------------------
.. _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

   constraint is trying to match the position and eventually the rotation of the target.

   :value: 0

.. data:: CONSTRAINT_IK_DISTANCE

   Constraint is maintaining a certain distance to target subject to ik_mode

   :value: 1

.. _armatureconstraint-constants-ik-flag:

See :class:`bge.types.BL_ArmatureConstraint.ik_flag`

.. data:: CONSTRAINT_IK_FLAG_TIP

   Set when the constraint operates on the head of the bone and not the tail

   :value: 1

.. data:: CONSTRAINT_IK_FLAG_ROT

   Set when the constraint tries to match the orientation of the target

   :value: 2

.. data:: CONSTRAINT_IK_FLAG_STRETCH

   Set when the armature is allowed to stretch (only the bones with stretch factor > 0.0)

   :value: 16
   
.. data:: CONSTRAINT_IK_FLAG_POS

   Set when the constraint tries to match the position of the target.

   :value: 32

.. _armatureconstraint-constants-ik-mode:

See :class:`bge.types.BL_ArmatureConstraint.ik_mode`

.. data:: CONSTRAINT_IK_MODE_INSIDE

   The constraint tries to keep the bone within ik_dist of target

   :value: 0

.. data:: CONSTRAINT_IK_MODE_OUTSIDE

   The constraint tries to keep the bone outside ik_dist of the target

   :value: 1
   
.. data:: CONSTRAINT_IK_MODE_ONSURFACE

   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

-------------
KX_GameObject
-------------
.. _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

.. _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

-------------
Mouse Buttons
-------------

See :class:`bge.types.SCA_MouseSensor`

.. data:: KX_MOUSE_BUT_LEFT
.. data:: KX_MOUSE_BUT_MIDDLE
.. data:: KX_MOUSE_BUT_RIGHT

--------------------------
Navigation Mesh Draw Modes
--------------------------

.. _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

   :value: 0

.. data:: KX_STATE_OP_CPY

   Copy state mask

   :value: 1
   
.. data:: KX_STATE_OP_NEG

   Invert bits to state mask

   :value: 2

.. data:: KX_STATE_OP_SET

   Add bits to state mask

   :value: 3

.. _Two-D-FilterActuator-mode: