Use OnCollisionEnter but also passable

I am making water using a plane. I need to be able to fall into the water and I want to get a collision event on the surface of the water (to get the collision location).

I need to get all the collided points to create a ripple effect. Setting isTrigger to on makes the surface passable, but the OnTriggerEnter method only gets specific points, not all points that collided. On the other hand, OnCollisionEnter seems to get all the points, but the surface can’t pass.

Is there any way to get this?

I’ve thought about this before but never actually done it. One way might be to have a proxy object moved precisely with your player but set to collide with nothing except the hard plane of the water, which would also be layered to NOT collide with your player.

This way your player would plunge on through because they wouldn’t hit the collider, but they would hit the trigger so they know they’re in water.

To do this you would be using Layers and LayerMasks and the Physics collision matrix.

Thankyou for answer.

I want all collidable objects to produce a ripple effect, not just the player. Then it would seem that would have to create a proxy object for every object that could collide, which seems impossible…

Detection on the water plane seems good, but I’m not sure how.

Thread locked. Please do not create duplicate threads

1 Like