I'm trying to understand how to work the rotation out of the sphere in the gif linked below. Given the spheres Radius, currentMatrix, and a nextPosition Vector, how do I work out the sphere's newMatrix?
Does any one have any ideas? I've tried googling a bunch of stuff but I'm not really sure if I've found the right equation of formula to work this out. Any guidance would be really appreciated

Input: Sphere Radius
Sphere currentMatrix
Move around: nextPosition Vector
Output: Sphere newMatrix
I assume by
sphereMatrixyou mean the 3×3 orientation matrix describing the local to global transformation matrix.In general a body with rotational velocity ω=
(ωx,ωy,ωz)and orientation matrix R will update the orientation matrix after some time Δt by converting the rotational velocity into an axis of rotation and a small angle of rotation.So you have R' = Rot(k, Δθ)*R
What is the rotation axis k? Take the direction of ω with k=ω/
mag(ω)and the small angle Δθ=mag(ω)*Δt.Lastly look up the Rodrigues' rotation formula to conver the axis angle into a 3×3 rotation matrix.
In the video the rotation matrix is found by the no-slip condition on the contact of the sphere with the floor. From rigid body mechanics it is found that
ω =
[vy/R,0,-vx/R]if
Ris the radius of the sphere, +y is the "up" direction andvx,vyare the velocity components of the center of the sphere along the x and y directions.