Re: Object rotation
- From: "Phillip Stafford" <prstafford@xxxxxxxxx>
- Date: Tue, 12 Apr 2005 10:54:40 -0400
Wow! So simple to do...thanks a lot! Made all the difference in the world.
Another question?
For each object drawn, can you have only one "Device.Transform.World = "???
I've tried breaking it up in multiple lines yet only the last one goes into
effect.
Thanks again.
"Phil Taylor" <ptaylor@xxxxxxxxxxxxxxxxxxx> wrote in message
news:%234lkgWxPFHA.2680@xxxxxxxxxxxxxxxxxxxxxxx
> 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: Phil Taylor
- Re: Object rotation
- References:
- Object rotation
- From: Phillip Stafford
- Re: Object rotation
- From: ZMan
- Re: Object rotation
- From: Phil Taylor
- Object rotation
- Prev by Date: Re: simple texture help
- Next by Date: Re: Object rotation
- Previous by thread: Re: Object rotation
- Next by thread: Re: Object rotation
- Index(es):
Relevant Pages
|