Model rotation

From EDukeWiki
Revision as of 11:27, 16 November 2012 by Hendricks266 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

EDuke32 allows CON and maphack definition of model replacement dynamic rotation for any sprite, using five members of the spriteext structure: pitch, roll, mdxoff, mdyoff, and mdzoff.

pitch and roll contain the values of rotation for the actor's model around the X-axis and Y-axis respectively.

mdxoff, mdyoff, and mdzoff offset the rotation center from the model center along the X-, Y-, and Z- axes respectively, as you can see below.

The values are expressed in Build units. (For pitch, -512 looks up while 512 looks down.)



While the pitch is a rotation about the Y-axis (i.e. would make Duke on the above picture lean forward if given a positive value), the roll makes the model spin around the X-axis. The rotation center is the model center (rendered at the floor by Build) unless you offset it using mdxoff, mdyoff or mdzoff member. That's what would give a 256 roll of the player sprite:


If you put a -8192 mdzoff before the rotation, the center of the model will be moved to the height of the crate on the right of the screen, and you'll get a rotation which might be more convenient to you: