Simulate dropping a ball in a river

Hi,

I’m trying to simulate a ball being dropped into water. I’m using ammojs as the physics engine. The ball being dropped from a height will gradually decrease its downward acceleration from the time it comes in contact with the water body. I’m unable to do that. I don’t want to use a particle system to render water molecules due to the tradeoff in performance.
The semi transparent cube may represent water and whenever the ball gets inside it the reduction in acceleration should apply.
Any thoughts on how I can achieve it?

Thanks in advance!

cc @Cedric and @carolhmj but I don’t know if a physics engine can do that… Maybe it can be simulated by creating an area where the friction/viscosity is greater than air?

How can I create an are with high friction? I couldn’t find any resource related to explaining how I can implement a passable area (like a tunnel) inside which the environment properties are different

For such manipulation, I would change the body linear velocity. Like applying a factor to increase or decrease the damping.
It would look like:

scene.onBeforeRenderObservable.add(()=>{
impostor.setLinearVelocity(impostor.getLinearVelocity().scale(dampingFactor));
});

and change dampingFactor value depending on where the impostor is.
a value of 1 means no damping.

3 Likes