rotation - Rotating a model around all 3 (X, Y, Z) axis in DirectX 11.2 C++ -


i have next problem. trying rotate 3d model around 3 axis @ same time. meaning want rotate model around x axis, y axis, again x , forth pressing buttons on keyboard. problem when use xmmatrixrotationx, xmmatrixrotationy or xmmatrixrotationz this:

    void rotate(float radians_x, float radians_y, float radians_z)     {         directx::xmstorefloat4x4(&_transfer.world, directx::xmmatrixtranspose(directx::xmmatrixrotationz(radians_z)));         directx::xmstorefloat4x4(&_transfer.world, directx::xmmatrixtranspose(directx::xmmatrixrotationy(radians_y)));         directx::xmstorefloat4x4(&_transfer.world, directx::xmmatrixtranspose(directx::xmmatrixrotationx(radians_x)));     } 

only last rotation gets done. want able rotate object around each of axis specific angle (actually, radians), can see in code. have found out xmmatrixrotationaxis method this, takes 1 angle parameter, , want use different 1 each axis. can me how can done?

also, don't know send first parameter xmmatrixrotationaxis, says vector of axis. don't understand how access those, methods used in code posted don't need sent axis. dont understand why necessary, or how it, in case right solution.

any appreciated.

i have found answer here:

http://books.google.hr/books?id=7zklaaaaqbaj&pg=pa251&lpg=pa251&dq=xmmatrixrotationquaternion&source=bl&ots=xveqhsj-x_&sig=ny6idk1jnfbf99lyc_hy8b-y4ti&hl=hr&sa=x&ei=dtkqvomma8axatfugzgl&ved=0cheq6aewca#v=onepage&q=xmmatrixrotationquaternion&f=false

i have use xmmatrixrotationrollpitchyaw. code looks:

    void rotate(float radians_x, float radians_y, float radians_z)     {         directx::xmstorefloat4x4(&_transfer.world, directx::xmmatrixtranspose(directx::xmmatrixrotationrollpitchyaw(radians_x, radians_y, radians_z)));     } 

works charm :)


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -