user181351
user181351

Reputation:

World axis to local axis

How can I modify/rotate an axis angle from world coords to object coords?

See below:

void RotateMatrix4(float *m, float angle, float *axis);
//This function rotates a matrix in object space

void RotateLocal(float angle, float *axis) {
    RotateMatrix4(m, angle, axis)
}

void RotateGlobal(float angle, float *axis) {
    //Do something to axis here
    RotateMatrix4(m, angle, axis)
}

Upvotes: 0

Views: 454

Answers (1)

Arne Bergene Fossaa
Arne Bergene Fossaa

Reputation: 652

You found the answer yourself - that is simply a multiplication between a tranformation matrix and a vector - you are simply transforming the axis vector into object coords.

Look at Transformation Matrix for more information on Transformation matrices.

(I would comment on your answer - but my rank is not yet high enough...)

Upvotes: 1

Related Questions