Ignore collisions between two physics objects

Hi!

Is it possible to ignore the collision between two physics objects? I’ve tried ignore parnet but that didn’t seem to work.

Any help would be nice!

Givo

which physics plugin?

A mockup PG would be nice.

cannon.js

I have a sphere start in a box, both with imposters. When I impulse the sphere out of the box, the collision between the box and it mess up the direction it is going.

Thanks for the reply.

What happens if you give the box an impostor after the sphere escapes the box?

The collisionFilterGroup and collisionFilterMask might work here.

See example cannon code here cannon.js/collisionFilter.html at master · schteppe/cannon.js · GitHub. Likely you will need to specify these when the impostor is created along with the mass.

Thanks!

I’ll try those. Having an un-skewed flight course of the sphere is necessary for a fps game!

I just tried, and they didn’t seem to work.
Also, here is a playground: https://www.babylonjs-playground.com/#Z0QW21#26
Aim at a 45 degree angle up, and the sphere hits the cylinder physics impostor. shammo is the sphere, player0 is the cylinder.

And, add in question. can I use shammo.intersectsMesh(ground0, true); with it working? When the sphere hits the plane you get moved to where it hit. but it freezes the plaground when un-annotated.
It is in the render loop already.

Thanks for the help!

Givo

See this: https://www.babylonjs-playground.com/#Z0QW21#27. by setting collisionFilterGroup and mask you can make it so that the ball hits the ground but it wont hit anything else.

After that is done i dont think shammo.intersectsMesh(player0, true); will work until you set back the filter group/mask

Thanks!

This should work great.

Now for the other question.

So I am detecting when the ball hits the ground. My if loop freezes the playground because technically shammo is local. Is there any way to deal with that?

It’s at lines 258-264 commented out.

You should create an array of the spheres you create and use those in your update loop. Currently they are not accessible

Ok, new problem.
So here: https://www.babylonjs-playground.com/#Z0QW21#29

I have a loop making a long ground.

At line 98 I made the sphere, and updating the in the pewpew function.

Now an issue is that if you shoot a sphere, when it hits the ground it will disappear and you will be teleported to it. But if you shoot more than one, only the last one will teleport you. Also, they can’t collide with each other. Any fixes or ideas?

Thanks for the help.

Givo