Selaa lähdekoodia

Added documentation for physics event checkbox/filtering (#509)

Mathias Westerdahl 6 kuukautta sitten
vanhempi
commit
f426106101
2 muutettua tiedostoa jossa 42 lisäystä ja 2 poistoa
  1. 33 2
      docs/en/manuals/physics-messages.md
  2. 9 0
      docs/en/manuals/physics-objects.md

+ 33 - 2
docs/en/manuals/physics-messages.md

@@ -1,11 +1,42 @@
 ---
 title: Collision messages in Defold
-brief: When two objects collide, the engine will broadcast messages to all components in both objects.
+brief: When two objects collide, the engine may call the event listener or broad cast messages.
 ---
 
 # Collision messages
 
-When two objects collide, the engine will broadcast messages to both objects:
+When two objects collide, the engine will may send an event to the event callback, or broadcast messages to both objects.
+
+## Event filtering
+
+The types of events generated may be controlled using the flags for each object:
+
+* "Generate Collision Events"
+* "Generate Contact Events"
+* "Generate Trigger Events"
+
+These are all `true` by default.
+When two collision objects interact, we check if we should send a message to the user, given these checkboxes.
+
+E.g. given the "Generate Contact Events" checkboxes:
+
+When using `physics.set_listener()`:
+
+| Component A | Component B | Send Message |
+|-------------|-------------|--------------|
+| ✅︎          | ✅︎          | Yes          |
+| ❌          | ✅︎          | Yes          |
+| ✅︎          | ❌          | Yes          |
+| ❌          | ❌          | No           |
+
+When using the default message handler:
+
+| Component A | Component B | Send Message(s)   |
+|-------------|-------------|-------------------|
+| ✅︎          | ✅︎          | Yes (A,B) + (B,A) |
+| ❌          | ✅︎          | Yes (B,A)         |
+| ✅︎          | ❌          | Yes (A,B)         |
+| ❌          | ❌          | No                |
 
 ## Collision response
 

+ 9 - 0
docs/en/manuals/physics-objects.md

@@ -92,6 +92,15 @@ Group
 Mask
 : 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).
 
+Generate Collision Events
+: If enabled, will allow this object to send collision events
+
+Generate Contact Events
+: If enabled, will allow this object to send contact events
+
+Generate Trigger Events
+: If enabled, will allow this object to send trigger events
+
 
 ## Runtime properties