So I am trying to get a dynamic rotated rectangle with velocity to glide along a static rectangles surface after collision, but I am having trouble with rotating the surface normal vector to the surface vector.
Hopefully this helps. minTime.getStaticAxis() above would be the green vector in this picture and I am having a problem rotating the green vector to the yellow vector. Essentially after i get the yellow vector I will project the blue vector (velocity) onto the yellow vector (or its negative if it matters).
Turns out that what I originally did was correct, however I prefer your way. The tip on using atan2 rather than anglebetween() showed that the error was in angleBetween(), it did not say whether the angle was negative or not.
I am still running into some problems (sometimes the dynamic rectangle gets stuck on the surface) but these are most likely from not adding enough of a “buffer” to seperate the shapes that I am playing with now.
I heard many good things of dyn4j but I need my physics for this game to be deterministic across machines, I am even going to fork jme vector3f down the road and add strictfp and replace fastMath with StrictMath. This example is also getting close to the end of what i need for physics.
Turns out the only thing working is if I find surface vector (yellow) by rotating just shy of 90 degrees to help it get out of the way of. Is there a way to do this with cross products? or just go back to quaternion?
EDIT: SCRATCH THIS, was just something silly on my part it works without varying degrees.