[SOLVED] Number of objects in collision with one single object

Quick question, is there a way to identify the number of objects in collision with a single object? For example, I have a player and he’s colliding with a table, a chair, and a cup, and I want to get the number of things he’s touching. In this example, the answer is 3. Is there a way to do this? I can handle simple javascript if its necessary.

Perhaps add all objects to a group, then check if that group is in collision with the player. If so, get the number of items from that group currently picked.

2 Likes

One way would be to have all objects in a group “objects” and run a For each instance of “objects” group, checking if objects are in collision with the player. Everytime the condition (collision) is true, add 1 to a counter. This counter will be the number of objects in collision with the player.

Great idea! The objects are already in a group, but the expression / condition that returns picked instances does not account for collisions (may be a bug / something on my end?). I could use the “pick nearest”. Will update this thread if I find anything!

Here’s a demo that seems to work ok:

Peek 2022-09-11 20-59

4 Likes

This is perfect! Probably just needs tweaking on my end. I’m marking this thread as solved for now. Thanks @anon14980890 and @Bluzima.

1 Like