Re: Object rotation
- From: "ZMan" <zman@xxxxxxxxxxxxxx>
- Date: Mon, 11 Apr 2005 19:34:04 -0700
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
- Object rotation
- Prev by Date: Render to Texture
- Next by Date: Re: Direct3D Picking?
- Previous by thread: Object rotation
- Next by thread: Re: Object rotation
- Index(es):
Relevant Pages
|