Wednesday, 15 August 2012

rotation - unity3d. How to get the result of transform.rotate without actually changing the gameobjects transform -



rotation - unity3d. How to get the result of transform.rotate without actually changing the gameobjects transform -

in unity3d i'm entering transforms position, rotation , scale matrix4x4 in order draw gizmos. i'd rotation quaternion entered matrix rotated amount of euler angles (angle) attempt, making re-create of transform (temp) , calling rotate() on , passing rotation quaternion matrix.

transform temp = transform; temp.rotate(new vector3(0f,0f,angle)); matrix4x4 rotationmatrix = matrix4x4.trs(transform.position,temp.rotation,transform.lossyscale);

unfortunately when rotates original transform , not temporary re-create of intended. how can add together amount of euler angle rotation quaternion?

i think i've answered question doesnt prepare problem...

matrix4x4 rotationmatrix = matrix4x4.trs(transform.position,transform.rotation*quaternion.angleaxis(angle,vector3.forward),transform.lossyscale);

rotation unity3d quaternions

No comments:

Post a Comment