pmndrs / use-cannon

👋💣 physics based hooks for @react-three/fiber

Home Page:https://cannon.pmnd.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Detect collision between two kinematic objects

berkaycirak opened this issue · comments

Hi,
I am trying to do a project where two models in it. There is a kinematic ball which can move with mouse, and also there is another ball which stays as a static. I want to detect when kinematic ball collides with that static ball. Is there any idea?
https://codesandbox.io/s/ballpit-forked-q87cos?file=/src/App.js

I think there is only detection between a dynamic type and a non-dynamic type of objects. Therefore, should I use a static floor just below the dynamic object?

I have solved that issue by removing mass and passing isTrigger:true prop for staticBall
const [ref] = useSphere((index) => ({ type: "Dynamic", isTrigger: true, position: [0, 0, 0], args: [1.2] }))