lo-th / Oimo.js

Lightweight 3d physics engine for javascript
http://lo-th.github.io/Oimo.js
MIT License
3.05k stars 301 forks source link

Contact callback #101

Open Bikeman868 opened 3 years ago

Bikeman868 commented 3 years ago

Hi, is there any way to get a callback when two objects collide? or better still attach a callback to a specific rigid body and get a callback when it collides with something?

I have seen this demo but this technique requires me to check every rigid body against every other rigid body to know if anything is colliding.

Imagine that the player in my game fires a bullet and I want to know when/if it hits anything. Testing each bullet against every object in the scene on each step is obviously not feasible.

Thanks.

lo-th commented 3 years ago

Hi i update physics engine with new version you have more option for collision callback you can use new lib https://github.com/lo-th/phy

On Tue, Jul 27, 2021 at 4:03 PM Bikeman868 @.***> wrote:

Hi, is there any way to get a callback when two objects collide? or better still attach a callback to a specific rigid body and get a callback when it collides with something?

I have seen this demo http://lo-th.github.io/Oimo.js/index.html#rotation but this technique requires me to check every rigid body against every other rigid body to know if anything is colliding.

Imagine that the player in my game fires a bullet and I want to know when/if it hits anything. Testing each bullet against every object in the scene on each step is obviously not feasible.

Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lo-th/Oimo.js/issues/101, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL3GOCZTWUO52WEXGEFSETTZ24B5ANCNFSM5BCJ5KBA .

-- lo.th http://lo.th - Freelance wegl developper & 3d modeler - github https://github.com/lo-th- twitter https://twitter.com/3dflashlo

Bikeman868 commented 3 years ago

From the readme it looks like Phy is a game engine that uses Three under the hood. I don't want to use Three, I want to integrate with a different game engine.