Jump to content

Component: Collision Detector Template (Sensors)

From Flowcode Help
Revision as of 14:37, 13 July 2026 by SteveT (talk | contribs) (Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder"")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Author Matrix Ltd
Version 1.2
Category Sensors


Collision Detector Template component

Polls a chosen panel object to see if it has collided with another object. When collisions happen, a user notification event is generated and a pin is set or reset. Another event is sent when the two objects separate.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_Collision_Detector.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_Collision_Detector.fcfx

Detailed description

No detailed description exists yet for this component

Examples

No additional examples






Macro reference

ReadState

ReadState
Get the current collision state. The 'Polarity' property will affect whether a collision is represented by a high or low state. 
- BYTE Return


SetTarget

SetTarget
Set the object that you want to test for collision with. If this is not called, or is called with handle = 0, collisions will be tested against every panel object that has 'Solid' status. NB) Specifying an object will save CPU power!! 
- HANDLE Target
The object to test for collision with. 
- VOID Return


WaitUntilHigh

WaitUntilHigh
Pause the program until the detector goes high. 'Polarity' will affect whether high value represents a collision or separation. NB) In simulation, only use this macro if testing for collision with animated or timer driven objects!! 
- VOID Return


WaitUntilLow

WaitUntilLow
Pause the program until the detector goes low. 'Polarity' will affect whether low value represents a collision or separation. NB) In simulation, only use this macro if testing for collision with animated or timer driven objects!! 
- VOID Return


Property reference

Properties
Connections
Pin
The pin that should change state when objects collide or separate. 
Polarity
Active High = Pin is high when objects collide, low when they are separate. Active Low = Pin is low when objects collide, high when they are separate. 
Simulation
Test Object
The object to test for collisions. A user event is sent each time this object collides with any other, or when the two object separate. 
Mouse Object
Choose an object that the user can clock on to simulate a collision when testing. 
Detector Ident
An ID value to identify this particular detector. Will be sent as the 'Ident' value for the notification events sent out so that multiple detectors can be told apart. 
Timer Interval (ms)
Time in milliseconds between collision scans. Small time = Greater CPU load Large time = More like to miss brief collisions.