This is probably trivial, but I'm having trouble making it work.
I have a 3-coordinate world of particles simulated with Verlet Velocity. I only care for collision between their centers and a few static AABBs.
Essentially, I can't get a clean way of resolving a collision.
For example, say I have a box with coordinates:
min = (0, -1, -384)
max = (512, 1, 0)
Any particle colliding with it should stop moving in the relevant direction, but continue moving in the others - not bounce off.
I have one particle at pos
that in a single timestep wants to go to newpos
(it's being pushed both downward and eastward):
pos = (-0.068037, 0.000000, -58.516845)
newpos = (0.014446, 0.000000, -58.555490)
Clearly, on the X axis there is a collision. My ray collider detects it and pops back the point where the ray intersects the AABB:
intersection = (0.000000, 0.000000, -58.548722)
Now, if I just set the position to that point, at the next time step there will be a collision because the position will be exactly on the border of the AABB.
This makes every particle "stick" to whatever box they collide with. In the previous example, I'd like to have the particle slide down the AABB wall according to its current velocity.
How can I do that?