jon3de Posted January 27, 2017 Share Posted January 27, 2017 hi, I know how to do some basic rotations with vex although the objects is always rotation around itself. Is it possible to do the same thing but use an external rotation point e.g. one of the corners of the box ? Quote Link to comment Share on other sites More sharing options...
dchow1992 Posted January 27, 2017 Share Posted January 27, 2017 offset position, rotate, subtract offset 1 Quote Link to comment Share on other sites More sharing options...
fsimerey Posted January 30, 2017 Share Posted January 30, 2017 (edited) And you can do more. Rotate along the vector defined by 2 specific points in full 3d: // Points to define vector axis and center vector P0 = point(0, "P", chi("p0_axis")); vector P1 = point(0, "P", chi("p1_axis")); vector axis = normalize(P1 - P0); vector center = P1 - (P1 - P0) / 2; // offset to center vector _P = @P - center; float ang = chf('angle'); vector4 q = quaternion(radians(ang), axis); // rotate P and N @P = qrotate(q, _P); @N = normalize(qrotate(q, @N)); // replace to origin @P += center; Edited January 30, 2017 by fsimerey Correction for center 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.