Re: Object rotation



in addition, if the default location isnt centered around the origin, you
need to translate back to the origin first, then rotate, then translate to
new position.

most people author objects centered around the origin, though, so you can
simply apply the transformations in the proper order, as ZMan suggested.

"ZMan" <zman@xxxxxxxxxxxxxx> wrote in message
news:O7iyVgwPFHA.1268@xxxxxxxxxxxxxxxxxxxxxxx
> Transformations need to be done in a specific order to get the effect you
> intended. For example rotations are ALWAYS around an axis so if you
> translate it first you get a different effect that translating it after.
>
> I'm not 100% sure what result you are looking for but switching the
> Translation and the rotation in your formula will give you a different
> result.
>
>
> --
> ZMan (zman@xxxxxxxxxxxxxx)
> http://www.thezbuffer.com
> News and Information for Managed DirectX
>
>
> "Phillip Stafford" <prstafford@xxxxxxxxx> wrote in message
> news:OOOdndG1moqZLsffRVn-ig@xxxxxxxxxxxxxx
>> Isit possible to rotate an object on the Z axis without rotating the
>> world?
>>
>> I am working on some commands that move a mesh in 3d world space.
>> Currently, by pressing the arrow keys, the object moves to the left,
>> right, up, or down. When I move it left, I would like the object to
>> rotate on the Z axis yet still move to the left as if it had not rotated
>> (basically, moving left on the original X axis). Currently what happens
>> is it rotates, then moves on the new x axis after the Z rotation.
>>
>> The code originally was...
>>
>> device.Transform.World = Matrix.Scaling(Scale, Scale, Scale) *
>> Matrix.Translation(XLocation, YLocation, ZLocation;
>>
>> For the rotation, I have changed to ...
>> device.Transform.World = Matrix.Scaling(Scale, Scale, Scale) *
>> Matrix.Translation(LocationX, LocationY, LocationZ) *
>> Matrix.RotationZ(angle);
>>
>> I have been searching the web for the past 2 hours and can't seem to find
>> a solution. Maybe I am missing something very obvious..I don't know.
>> Any help is greatly appreciated.
>>
>>
>>
>>
>
>


.



Relevant Pages

  • Re: newbie: rotating meshes
    ... The problems I noticed, were if you for example rolled the ship, then tried ... not the rolled x axis, which says to me that the math for matrix ... concatenation doesnt rotate the values of the matrix correctly is some ... which meant the y roation rotated the models x axis whereas the z rotation ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: translation and rotation in Euclidean space
    ... In the second place a single rotation only requires a 2x2 matrix. ... do and wish to rotate and translate a scene it is helpful if you process ... a 2d rank tensor, say Lij, a vector is a 1st rank tensor say Xi and ...
    (sci.physics.relativity)
  • Re: translation and rotation in Euclidean space
    ... In the second place a single rotation only requires a 2x2 matrix. ... do and wish to rotate and translate a scene it is helpful if you process ... a 2d rank tensor, say Lij, a vector is a 1st rank tensor say Xi and ...
    (sci.physics.relativity)
  • Re: Object rotation
    ... > need to translate back to the origin first, then rotate, then translate to ... For example rotations are ALWAYS around an axis so if you ... then moves on the new x axis after the Z rotation. ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: Object rotation
    ... For example rotations are ALWAYS around an axis so if you ... translate it first you get a different effect that translating it after. ... Translation and the rotation in your formula will give you a different ... > rotate on the Z axis yet still move to the left as if it had not rotated ...
    (microsoft.public.win32.programmer.directx.managed)

Loading