# Question about rotations off 90 degrees

#### Mr Martian

Donator
Hi There,

wondering if anyone had a similar issue and found a fix. I am trying to code an animation that rotates not along X, Y or Z axis by 90 degrees, but rather along both the X and Z axis (essentially rotating along an axis 45 degrees from Z, if that makes sense, here is the code I have for it:

static MGROUP_ROTATE mgt_leftgearclaw1 (Mesh_Main, &RearGearLeftClaw1, 1, _V(-78.16914, -53.25367, -20.11191), _V( 0.5, 0.0, 0.5), (float)85*RAD);

however like this the animated group appears distorted and misshaped when I reload the scenario to current state.

Does anyone know why this might be happening?

Thanks in advance #### Urwumpe

##### Not funny anymore
Donator
Yes, the problem is, that your direction vector is not normalized to length 1.0. That causes distortions.

For what you want to achieve, the simplest way to create such a vector is defining a constant with the value: _V(1.0, 0.0, 1.0)/sqrt(2.0)

or : _V(1.0/sqrt(2.0), 0.0, 1.0/sqrt(2.0))

#### asbjos

##### tuanibrO
Or simply use the API function unit() (or normalise() if you need the normalised vector several times).

So something like this:
Code:
static MGROUP_ROTATE mgt_leftgearclaw1(
Mesh_Main,
&RearGearLeftClaw1, 1,
_V(-78.16914, -53.25367, -20.11191),
[I]unit(_V( 0.5, 0.0, 0.5)),[/I]
);

#### Mr Martian

Donator
Thank You!

Yes, the problem is, that your direction vector is not normalized to length 1.0. That causes distortions.

For what you want to achieve, the simplest way to create such a vector is defining a constant with the value: _V(1.0, 0.0, 1.0)/sqrt(2.0)

or : _V(1.0/sqrt(2.0), 0.0, 1.0/sqrt(2.0))

Thanks so much Urwumpe! that's a big help!