Blender Git Loki
Git Commits -> Revision bc8f002
Revision bc8f002 by Benoit Bolsee (master) August 23, 2008, 11:54 (GMT) |
BGE state system improvement: the sensor with Level option enabled will trigger the controller of a newly activated state, even if the sensor is already connected to an active state; new isTriggered() python function to determine which sensor triggered the current controller. Previously, this behaviour was available only for sensors that were not connected to any active state, which was forcing the game designer to duplicate sensors in some cases. For example the Always sensors used to initialize the states needed to be duplicated for each state. With this patch, a single Always sensor with Level option enabled will suffice to initialize all the states. A Python controller can determine which sensor did trigger with the new SCA_ISensor::isTriggered() function. Notes: - When a sensor with level option enabled is connected to multiple controllers, only those of newly activated states will be triggered. The controllers of already activated states will receive no trigger, unless the sensor internal state toggled, in which case all the controllers are triggered as always. - The old isPositive() function returns the internal state of the sensor, positive or negative; the new isTriggered() function returns 1 only for sensors that generated an event in the current frame. |
Commit Details:
Full Hash: bc8f002a4c68235db766fbd72bc383feb7836341
SVN Revision: 16236
Parent Commit: 2076703
Lines Changed: +100, -19
9 Modified Paths:
/source/gameengine/GameLogic/SCA_IController.cpp (+2, -0) (Diff)
/source/gameengine/GameLogic/SCA_ISensor.cpp (+39, -6) (Diff)
/source/gameengine/GameLogic/SCA_ISensor.h (+9, -4) (Diff)
/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp (+1, -1) (Diff)
/source/gameengine/GameLogic/SCA_LogicManager.cpp (+25, -6) (Diff)
/source/gameengine/GameLogic/SCA_LogicManager.h (+2, -0) (Diff)
/source/gameengine/GameLogic/SCA_PythonController.cpp (+10, -1) (Diff)
/source/gameengine/GameLogic/SCA_PythonController.h (+6, -0) (Diff)
/source/gameengine/PyDoc/SCA_ISensor.py (+6, -1) (Diff)
/source/gameengine/GameLogic/SCA_ISensor.cpp (+39, -6) (Diff)
/source/gameengine/GameLogic/SCA_ISensor.h (+9, -4) (Diff)
/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp (+1, -1) (Diff)
/source/gameengine/GameLogic/SCA_LogicManager.cpp (+25, -6) (Diff)
/source/gameengine/GameLogic/SCA_LogicManager.h (+2, -0) (Diff)
/source/gameengine/GameLogic/SCA_PythonController.cpp (+10, -1) (Diff)
/source/gameengine/GameLogic/SCA_PythonController.h (+6, -0) (Diff)
/source/gameengine/PyDoc/SCA_ISensor.py (+6, -1) (Diff)