how would I rotate an object around an object, such as rotating an object in circles around another object? Preferably using GL.Rotate and as little math as possible!
GL.Rotate
defines a rotation matrix, that rotates a round 0.0. If you want to rotate around a pivot ( pivotX
, pivotY
) you have to:
eg:
GL.Translate(pivotX, pivotY, 0); // 3. move back
GL.Roatate(angle, 0, 0, 1); // 2. rotate
GL.Translate(-pivotX, -pivotY, 0); // 1. move pivot to (0, 0)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.