Collision physics for the camera

I’m trying to make it possible for the player’s camera to interact with meshes on the scene. https://www.babylonjs-playground.com/#4NHCRD#6 for example here, if you scroll up, the camera approaches the ball and bumps it but the ball doesn’t acquire impulse from the collision. I attached a mesh to the camera and enabled physics, so theoretically it should bounce from the camera. Is there any way to implement this?

Hello! I see you’re mixing the camera’s checkCollisions with physics, which isn’t supported, see: Combining Camera Controller with Cannon Physics - #5 by RaananW

Another observation is that it’s better to attach the mesh to the camera as its child, not its parent. The reason for that is when we move the camera through the controls, only its position is updated, which means the parent won’t be updated. But if you update any element’s position, all of its childrens’ positions will automatically be updated: Camera bump | Babylon.js Playground (babylonjs-playground.com)

2 Likes

Hello @Artod_ds just checking in, was your question answered?