- Home /
Shuriken world collision not working with mesh collider
I am trying to set up a situation where the player fires physical bullets which will collide with walls but also want the blood particle system spawned when a bullet hits an enemy to collide with those walls.
It seems I can get either to work but not both. When the walls are set to box colliders the bullets tend to go through which is fixed by making them mesh colliders. however, the particles then seem to go through but are deflected as if there is some kind of partial collision.
The ideal thing at the moment would be to get box collisions to work for efficiency but even with all the contiuous rigid bodies set up the bullets sneak through.
If there is no easy solution i guess i can give every wall a child collider of the other type so I have both.
Is shuriken world collision even supposed to work with mesh colliders yet?
It seems that the blood particles only bounce back from the mesh collider at a particular angle and they still tend to stay half in the wall even then.
EDIT: just tried the workaround of having two separate colliders for the wall on different layers, will work for now but i may need to have particles collide with more complex meshes at some point.
Yes, Shuriken mesh collisions work as of Unity 4.0. However, particle radius is not supported for world collisions so particles will collide using their center. For simpler geometry box colliders slightly larger than the geometry can be used to avoid the appearance of the particles partially "sinking into" the object when colliding.
For anything other than this I would suggest that you log a bug with the simplest possible reproducible that you can come up with.
I have tested a basic scene and it appears that I had the bounce value too low to clearly see what was happening, it appears that the mesh particle collision is using the centre point of the wall object ins$$anonymous$$d of the normal. I have submitted a bug report to demonstrate this.
I suppose with the bullet side of the problem there must be a bit of difference in the coding of box and mesh colliders even for the same shape, Is it possible that mesh is slower for the same shape but more accurate as well?
Good that you posted a bug we need feedback like this to tell whether features are working for the community.
$$anonymous$$eshes are not more accurate for world collisions regardless of the shape used (mesh, sprite, billboard) the collision code is the same and is just using the center of the object. If you have many particles onscreen meshes may be slower to render though as they have more triangles than, say, a billboard.
Answer by cregox · Apr 25, 2013 at 06:19 PM
In my case, both mesh and box colliders are working... But particles can get high speeds and thus walk through colliders (like any game object can).
There's a script to fix this for gameObjects, using raycast but unfortunatelly I don't think it can be applied to particles.
So, the only way around it for now is creating bigger and/or more colliders. Not always possible to do.