利用者:Sculptorjim/Game Engine/Logic/Sensors/Common Options

提供: wiki
< 利用者:Sculptorjim‎ | Game Engine‎ | Logic‎ | Sensors
2012年7月3日 (火) 22:15時点におけるwiki>Sculptorjimによる版
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

Sensor Common Options

Common Sensor Options

All sensors have a set of common buttons, fields and menus. They are organized as follows:


Triangle button
Collapses the sensor information to a single line (toggle).
Sensor type menu
Specifies the type of the sensor.
Sensor name
The name of the sensor. This can be selected by the user. It is used to access sensors with python; it needs to be unique among the selected objects.
X Button
Deletes the sensor.


The next line specifies the type of output pulse to be sent by the sensor. Sensors fire pulses to controllers.

BGE Sensor Level True Button.png
True level triggering. If this is set, the controllers receive TRUE pulses as long as the sensor's state is positive. The sensor will fire TRUE pulses with the frequency of the sensor.
BGE Sensor Level False Button.png
False level triggering. If this is set, the controllers receive FALSE pulses as long as the sensor's state is negative. The sensor will fire FALSE pulses with the frequency of the sensor.
Note about triggers
If you don't set any triggers, the sensor fires no pulse at all as long the sensor's state does not change. When the sensor changes it's state from negative to positive the sensor fires one TRUE pulse to the controllers. When sensor changes it's state from positive to negative the sensor fires one FALSE pulse to the controllers.
In between the controllers might still request the sensor's state, but if the controller does not get pulses (TRUE or FALSE) from any other sensor it will not be activated at all.
Freq
Despite the name, "Frequency", this parameter sets the delay between repeated pulses, measured in logic ticks. The default value is 0 and it means no delay.
Logic ticks have a frequency of 60 Hz (60 ticks per second). For example:
  • setting f=1 means the sensor pulses once every 60th of a second. A setting of f = 1, effectively means a 1 to 1 ratio between ticks, 1 tick = 1 pulse.
  • setting f=30 means the sensor pulses once after 30 ticks have elapsed. This means the pulse is emitted every half a second because there are 60 ticks per second by default.
  • setting f=60 means the sensor pulses every 60 ticks, which means one time per second
Raising the value of f is good for saving performance by not doing things more often than necessary.
Level Button
Triggers appropriate controllers when the state changes to a new value. (For more information see States).
Tap Button
Sends a positive pulse only once even if the sensor remains true. Only one of Tap or Level can be activated.
When the Tap parameter is set the sensor will fire a FALSE pulse within the next frame, even when the sensor event is still present. When the sensor's event goes away no pulse will be fired.
If the TRUE level triggering is set, the TRUE/FALSE pulse pair will be repeated until the sensor's event goes away.
The FALSE level triggering will be ignored when the Tap parameter is set.
Pulses will not be inverted when the Inv parameter is set. But the TRUE/FALSE pulse pair will be send when the sensor's event is not present.
Invert Button
This inverts the sensor output.
If this is set, the sensor will send FALSE pulses when the sensor should send TRUE pulses and TRUE pulses if the sensor should send FALSE pulses. If the Tap parameter is set, the sensor sends individual pulses (refer to the previous section) but TRUE/FALSE are reversed.
Note about Inv and triggers
Note that the toggle Inv inverts the level BEFORE the triggers, which means the triggers act on the signal coming out from Inv.