Collision Sensor: usePulseCollision

usePulseCollision
  • gets/sets if sensor is using pulse collisions.

Type: 
  • Boolean

Values:

  • 1 = True = using Pulse collisions
  • 0 = False = not using Pulse collisions

Pulse Enabled: 

  • Each collision with an object having the material/property sends one positive pulse to the connected controller(s). 
Pulse Disabled: 
  • A collision with an object having the material/property sends a positive pulse to the connected controller(s) only if the game object isn't already touching an object with the material/property.
Collision Sensor:
  • Leaving the Material/Property blank will cause the Collision Sensor to react to collisions with any game objects no matter what Material/Property they may have (this includes objects that don't have any Materials and/or Properties).
     
  • A collision with an object having the material/property sends a positive pulse to the connected controller(s) only if the game object isn't already touching an object with the material/property.
  • Continuously touching any game object with the material/property:  No pulses are sent to the connected controller(s).
  • Removing (no longer touching) all game objects with the material/property:  One negative pulse is sent to the connected controller(s).
Sample Code


################  using pulse collisions?

# import bge module
import bge

# get the controller
cont = bge.logic.getCurrentController()

# get the sensor attached to the controller
# my sensor is named Explode

sen = cont.sensors["Explode"]

# collision sensor using pulse collisions?
status = sen.usePulseCollision
 
Sample Code


################  use pulse collisions

# import bge module
import bge

# get the controller
cont = bge.logic.getCurrentController()

# get the sensor attached to the controller
# my sensor is named Explode

sen = cont.sensors["Explode"]

# set collision sensor to use pulse collisions
sen.usePulseCollision = True