Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isTrigger prop not implemented #1

Closed
mklasinc opened this issue Jan 28, 2022 · 3 comments
Closed

isTrigger prop not implemented #1

mklasinc opened this issue Jan 28, 2022 · 3 comments

Comments

@mklasinc
Copy link

Problem

The documentation says an isTrigger prop can be passed to the body to make it work as a collision detection trigger (similarly to how cannon-es, use-cannon work following this PR.

However, p2-es does not implement an isTrigger prop anywhere in the codebase.
You can instead pass the sensor boolean when instantiating a shape (codebase ref, but the current implementation off use-p2 doesn't allow to pass extra props to shapes.

Solution?

Add ability to pass extra props to shapes when creating a body or implement the isTrigger prop.

Also here's the p2.js sensor demo

@joergjaeckel
Copy link
Collaborator

Will take a look, meanwhile you can set collisionResponse false like in the example https://github.com/pmndrs/use-p2/blob/main/examples/src/demos/PhysicalCharacterController/Heart.tsx#L55

@joergjaeckel
Copy link
Collaborator

You can use it now as expected. Set an isTrigger prop to the body, it will set the sensor prop on each shape of the body. See examples/src/demos/Trigger.tsx

@mklasinc
Copy link
Author

Super, thanks for the quick action!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants