Difference between revisions of "Component: Collision Detector Template (Sensors)"
From Flowcode Help
Jump to navigationJump to search (XML import - Pre 8.0 release) |
|||
(12 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | {| style="width:50%" | |
− | |||
− | {| | ||
|- | |- | ||
− | | width="20%" style="color: gray;" | Author | + | | width="20%" style="color:gray;" | Author |
| Matrix Ltd | | Matrix Ltd | ||
|- | |- | ||
− | | width="20%" style="color: gray;" | Version | + | | width="20%" style="color:gray;" | Version |
− | | 1.2 | + | | 1.2 |
|- | |- | ||
− | | width="20%" style="color: gray;" | Category | + | | width="20%" style="color:gray;" | Category |
| Sensors | | 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: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_Collision_Detector.fcfx FC_Comp_Source_Collision_Detector.fcfx] | ||
− | + | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_Collision_Detector.fcfx FC_Comp_Source_Collision_Detector.fcfx] | |
− | + | ==Detailed description== | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | '' | + | ''No detailed description exists yet for this component'' |
− | + | ==Examples== | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | ''<span style="color:red;">No additional examples</span>'' | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | ==Macro reference== | ||
− | == | + | ===ReadState=== |
− | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | |
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadState''' | ||
+ | |- | ||
+ | | colspan="2" | Get the current collision state. The 'Polarity' property will affect whether a collision is represented by a high or low state. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | + | ===SetTarget=== | |
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetTarget''' | ||
+ | |- | ||
+ | | colspan="2" | 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!! | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-h32-icon.png]] - HANDLE | ||
+ | | width="90%" | Target | ||
+ | |- | ||
+ | | colspan="2" | The object to test for collision with. | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | + | ===WaitUntilHigh=== | |
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WaitUntilHigh''' | ||
+ | |- | ||
+ | | colspan="2" | 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!! | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | + | ===WaitUntilLow=== | |
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WaitUntilLow''' | ||
+ | |- | ||
+ | | colspan="2" | 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!! | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | + | ==Property reference== | |
− | The object to test for collisions. | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
− | + | |- | |
− | A user event is sent each time this object collides with any other, or when the two object separate. | + | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]] |
− | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties''' | |
− | + | |- | |
− | + | |- | |
− | + | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | |
− | + | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections | |
− | Choose an object that the user can clock on to simulate a collision when testing. | + | |- |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]] | |
− | + | | width="90%" | Pin | |
− | + | |- | |
− | + | | colspan="2" | The pin that should change state when objects collide or separate. | |
− | An ID value to identify this particular detector. Will be sent as the 'Ident' value for the notification | + | |- |
− | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |
− | events sent out so that multiple detectors can be told apart. | + | | width="90%" | Polarity |
− | + | |- | |
− | + | | colspan="2" | 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. | |
− | + | |- | |
− | + | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | |
− | + | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation | |
− | Time in milliseconds between collision scans. | + | |- |
− | + | |- | |
− | Small time = Greater CPU load | + | | width="10%" align="center" | [[File:Fc9-type-17-icon.png]] |
− | + | | width="90%" | Test Object | |
− | Large time = More like to miss brief collisions. | + | |- |
+ | | colspan="2" | 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. | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-17-icon.png]] | ||
+ | | width="90%" | Mouse Object | ||
+ | |- | ||
+ | | colspan="2" | Choose an object that the user can clock on to simulate a collision when testing. | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | ||
+ | | width="90%" | Detector Ident | ||
+ | |- | ||
+ | | colspan="2" | 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. | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | ||
+ | | width="90%" | Timer Interval (ms) | ||
+ | |- | ||
+ | | colspan="2" | Time in milliseconds between collision scans. Small time = Greater CPU load Large time = More like to miss brief collisions. | ||
+ | |} |
Latest revision as of 13:09, 7 February 2023
Author | Matrix Ltd |
Version | 1.2 |
Category | Sensors |
Contents
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. | |
![]() |
Return |
SetTarget
WaitUntilHigh
WaitUntilLow