Welcome to od|forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

# rotate with vex around axis next to the object

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 ?

##### Share on other sites

offset position, rotate, subtract offset

1 person likes this

##### Share on other sites

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');

// rotate P and N
@P = qrotate(q, _P);
@N = normalize(qrotate(q, @N));

// replace to origin
@P += center;```

Edited by fsimerey
Correction for center
2 people like this