Skip to content

Commit

Permalink
Site changes [skip-ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
defold-services committed Feb 18, 2025
1 parent 64811d5 commit 2959a6c
Show file tree
Hide file tree
Showing 3 changed files with 14,840 additions and 14,782 deletions.
37 changes: 34 additions & 3 deletions manuals/physics-messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,45 @@
layout: manual
language: en
github: https://github.com/defold/doc
toc: ["Collision messages","Collision response","Trigger response"]
toc: ["Collision messages","Event filtering","Collision response","Trigger response"]
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

Expand Down
9 changes: 9 additions & 0 deletions manuals/physics-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,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

Expand Down
Loading

0 comments on commit 2959a6c

Please sign in to comment.