engine icon indicating copy to clipboard operation
engine copied to clipboard

Be able to get contact result of trigger entity

Open albertvanveen opened this issue 2 years ago • 7 comments

Currently it's not possible to get the contact result of a trigger entity, while Ammo provides this information. It will be nice if I can access this information with a trigger entity. (I want to use a trigger entity on a AI to detect all entities in the surrounding and with the (local) position of the collision points I can let the AI ​​make the right decisions).

https://github.com/playcanvas/engine/blob/58ef2f524a2058467631e7722beee92caf2b8231/src/framework/components/rigid-body/system.js#L835C19-L835C30

albertvanveen avatar Sep 22 '23 18:09 albertvanveen

Hi @MushAsterion!

I know you've done some raycast upgrades in the past. First of all, thanks for that! Maybe you can help me with this as well?

Please see also my other related request: https://github.com/playcanvas/engine/issues/5669

Thank you in advance.

albertvanveen avatar Oct 16 '23 17:10 albertvanveen

Hey @albertvanveen, from what I see the trigger event was purposefully created without detailed payload back in 2013 while other collision events already had all contacts details so it may be nice to have more history from the Playcanvas team to know the reasoning

MushAsterion avatar Oct 17 '23 17:10 MushAsterion

Unfortunately, I don't know who is responsible for the physics of the engine. I hope @willeastcott can answer this question.

Do you think adding this feature will have breaking changes?

albertvanveen avatar Oct 17 '23 18:10 albertvanveen

To me the best integration would be to replace make the event's arg0 be a ContactResult for consistency with collisionstart and contact events which would be a breaking change.

MushAsterion avatar Oct 17 '23 18:10 MushAsterion

Only adding 'contact' for trigger entities without changing the other events (to prevent breaking changes) is no option?

albertvanveen avatar Oct 17 '23 19:10 albertvanveen

Would still be breaking for people relying on contact event firing for certain body combination and doesn't fix the root issue with triggerenter not being consistent with similar events

MushAsterion avatar Oct 17 '23 19:10 MushAsterion

We would need to avoid breaking changes unless it is the only necessary option. As engine "promises" to not break existing projects. If there is a path of no-breaking change - please consider it.

Maksims avatar Oct 18 '23 04:10 Maksims