Skip to content

Commit f426106

Browse files
authored
Added documentation for physics event checkbox/filtering (#509)
1 parent 53263a6 commit f426106

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

docs/en/manuals/physics-messages.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,42 @@
11
---
22
title: Collision messages in Defold
3-
brief: When two objects collide, the engine will broadcast messages to all components in both objects.
3+
brief: When two objects collide, the engine may call the event listener or broad cast messages.
44
---
55

66
# Collision messages
77

8-
When two objects collide, the engine will broadcast messages to both objects:
8+
When two objects collide, the engine will may send an event to the event callback, or broadcast messages to both objects.
9+
10+
## Event filtering
11+
12+
The types of events generated may be controlled using the flags for each object:
13+
14+
* "Generate Collision Events"
15+
* "Generate Contact Events"
16+
* "Generate Trigger Events"
17+
18+
These are all `true` by default.
19+
When two collision objects interact, we check if we should send a message to the user, given these checkboxes.
20+
21+
E.g. given the "Generate Contact Events" checkboxes:
22+
23+
When using `physics.set_listener()`:
24+
25+
| Component A | Component B | Send Message |
26+
|-------------|-------------|--------------|
27+
| ✅︎ | ✅︎ | Yes |
28+
|| ✅︎ | Yes |
29+
| ✅︎ || Yes |
30+
||| No |
31+
32+
When using the default message handler:
33+
34+
| Component A | Component B | Send Message(s) |
35+
|-------------|-------------|-------------------|
36+
| ✅︎ | ✅︎ | Yes (A,B) + (B,A) |
37+
|| ✅︎ | Yes (B,A) |
38+
| ✅︎ || Yes (A,B) |
39+
||| No |
940

1041
## Collision response
1142

docs/en/manuals/physics-objects.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ Group
9292
Mask
9393
: The other _groups_ this object should collide with. You can name one group or specify multiple groups in a comma separated list. If you leave the Mask field empty, the object will not collide with anything. [Learn more about collision groups](/manuals/physics-groups).
9494

95+
Generate Collision Events
96+
: If enabled, will allow this object to send collision events
97+
98+
Generate Contact Events
99+
: If enabled, will allow this object to send contact events
100+
101+
Generate Trigger Events
102+
: If enabled, will allow this object to send trigger events
103+
95104

96105
## Runtime properties
97106

0 commit comments

Comments
 (0)