Re: Object rotation
- From: "Phil Taylor" <ptaylor@xxxxxxxxxxxxxxxxxxx>
- Date: Mon, 11 Apr 2005 21:12:56 -0700
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.
>>
>>
>>
>>
>
>
.
- Follow-Ups:
- Re: Object rotation
- From: Phillip Stafford
- Re: Object rotation
- References:
- Object rotation
- From: Phillip Stafford
- Re: Object rotation
- From: ZMan
- Object rotation
- Prev by Date: Re: Direct3D Picking?
- Next by Date: Newbie Text question
- Previous by thread: Re: Object rotation
- Next by thread: Re: Object rotation
- Index(es):
Relevant Pages
|
Loading