Module GameTypes :: Class SCA_ISensor
[frames] | no frames]

Class SCA_ISensor

PyObjectPlus --+        
               |        
          CValue --+    
                   |    
     SCA_ILogicBrick --+
                       |
                      SCA_ISensor
Known Subclasses:

Base class for all sensor logic bricks.

Instance Methods
 
reset()
Reset sensor internal state, effect depends on the type of sensor and settings.
bool
isA(game_type)
Check if this is a type or a subtype game_type. (Inherited from GameTypes.PyObjectPlus)
    Deprecated
 
isPositive()
True if this sensor brick is in a positive state.
 
isTriggered()
True if this sensor brick has triggered the current controller.
 
getUsePosPulseMode()
True if the sensor is in positive pulse mode.
 
setUsePosPulseMode(pulse)
Sets positive pulse mode.
integer
getFrequency()
The frequency for pulse mode sensors.
 
setFrequency(freq)
Sets the frequency for pulse mode sensors.
 
getUseNegPulseMode()
True if the sensor is in negative pulse mode.
 
setUseNegPulseMode(pulse)
Sets negative pulse mode.
 
getInvert()
True if this sensor activates on negative events.
 
setInvert(invert)
Sets if this sensor activates on positive or negative events.
boolean
getLevel()
Returns whether this sensor is a level detector or a edge detector.
 
setLevel(level)
Set whether to detect level or edge transition when entering a state.
integer
getExecutePriority()
Gets the execution priority of this logic brick. (Inherited from GameTypes.SCA_ILogicBrick)
string
getName()
Returns the name of the CValue. (Inherited from GameTypes.CValue)
KX_GameObject
getOwner()
Gets the game object associated with this logic brick. (Inherited from GameTypes.SCA_ILogicBrick)
 
setExecutePriority(priority)
Sets the priority of this logic brick. (Inherited from GameTypes.SCA_ILogicBrick)
Instance Variables
int executePriority
This determines the order controllers are evaluated, and actuators are activated (lower priority is executed first). (Inherited from GameTypes.SCA_ILogicBrick)
int frequency
The frequency for pulse mode sensors.
bool invalid
Test if the object has been freed by the game engine and is no longer valid. (Inherited from GameTypes.PyObjectPlus)
boolean invert
Flag to set if this sensor activates on positive or negative events.
boolean level
Option whether to detect level or edge transition when entering a state.
string name
The name of this CValue derived object (read-only). (Inherited from GameTypes.SCA_ILogicBrick)
KX_GameObject or None in exceptional cases. owner
The game object this logic brick is attached to (read-only). (Inherited from GameTypes.SCA_ILogicBrick)
boolean positive
True if this sensor brick is in a positive state.
boolean tap
When enabled only sensors that are just activated will send a positive event, after this they will be detected as negative by the controllers.
boolean triggered
True if this sensor brick is in a positive state.
boolean useNegPulseMode
Flag to turn negative pulse mode on and off.
boolean usePosPulseMode
Flag to turn positive pulse mode on and off.
Method Details

reset()

 

Reset sensor internal state, effect depends on the type of sensor and settings.

The sensor is put in its initial state as if it was just activated.

isPositive()

 

True if this sensor brick is in a positive state.

Deprecated: use positive

isTriggered()

 

True if this sensor brick has triggered the current controller.

Deprecated: use triggered

getUsePosPulseMode()

 

True if the sensor is in positive pulse mode.

Deprecated: use usePosPulseMode

setUsePosPulseMode(pulse)

 

Sets positive pulse mode.

Parameters:
  • pulse (boolean) - If True, will activate positive pulse mode for this sensor.

Deprecated: use usePosPulseMode

getFrequency()

 

The frequency for pulse mode sensors.

Returns: integer
the pulse frequency in 1/50 sec.

Deprecated: use frequency

setFrequency(freq)

 

Sets the frequency for pulse mode sensors.

Parameters:
  • freq (integer)
Returns:
the pulse frequency in 1/50 sec.

Deprecated: use frequency

getUseNegPulseMode()

 

True if the sensor is in negative pulse mode.

Deprecated: use useNegPulseMode

setUseNegPulseMode(pulse)

 

Sets negative pulse mode.

Parameters:
  • pulse (boolean) - If True, will activate negative pulse mode for this sensor.

Deprecated: use useNegPulseMode

getInvert()

 

True if this sensor activates on negative events.

Deprecated: use invert

setInvert(invert)

 

Sets if this sensor activates on positive or negative events.

Parameters:
  • invert (boolean) - true if activates on negative events; false if activates on positive events.

Deprecated: use invert

getLevel()

 

Returns whether this sensor is a level detector or a edge detector. It makes a difference only in case of logic state transition (state actuator). A level detector will immediately generate a pulse, negative or positive depending on the sensor condition, as soon as the state is activated. A edge detector will wait for a state change before generating a pulse.

Returns: boolean
true if sensor is level sensitive, false if it is edge sensitive

Deprecated: use level

setLevel(level)

 

Set whether to detect level or edge transition when entering a state.

Parameters:
  • level (boolean) - Detect level instead of edge? (KX_TRUE, KX_FALSE)

Deprecated: use level


Instance Variable Details

level

Option whether to detect level or edge transition when entering a state. It makes a difference only in case of logic state transition (state actuator). A level detector will immediately generate a pulse, negative or positive depending on the sensor condition, as soon as the state is activated. A edge detector will wait for a state change before generating a pulse. note: mutually exclusive with tap, enabling will disable tap.
Type:
boolean

positive

True if this sensor brick is in a positive state. (read-only)
Type:
boolean

tap

When enabled only sensors that are just activated will send a positive event, after this they will be detected as negative by the controllers. This will make a key thats held act as if its only tapped for an instant. note: mutually exclusive with level, enabling will disable level.
Type:
boolean

triggered

True if this sensor brick is in a positive state. (read-only)
Type:
boolean