30-03-2018, 09:38 PM
(28-03-2018, 12:06 PM)josemendez Wrote: You might be running into tunneling issues. Moving an object using its transform is equivalent to teleporting it around between frames, so if you "teleport" fast enough that particles are left completely outside of the container, they will fail to detect any collision. This happens to all physics engines.
Obi uses continuous collision detection by default to prevent this, but CCD only works if the moving colliders have a velocity (because using the velocity, you can predict where the container is going to move next). So the container either needs to be a non-kinematic rigidbody and be moved around using forces/impulses, or if you can't afford to do this, you need to calculate your own velocity based on position deltas between frames.
There's the ObiKinematicVelocities component, that will calculate linear and angular velocities for kinematic rigidbodies, or if you desire to calculate them any other way, you can use it as a starting point to build your own.
Very interesting. Yes I do know about the problems with moving a containing around, that has something in it. I made a snow globe simulations a few months ago.
https://www.youtube.com/watch?v=mslLL5J0nps
and I had to deal with similar problems. I just made the snow go back into the snow globe if they hit the floor I think my solution was, but also changing how the collisions were updated. I had also messed with their gravity to make them float, and it sometimes caused the whole snowglobe to begin flying upwards
I will try to experiment a bit and see if I can make a container that might somehow have a velocity or something. That script you made will probably help.