Model rotation: Difference between revisions
No edit summary |
Hendricks266 (talk | contribs) No edit summary |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[EDuke32]] allows | [[EDuke32]] allows CON and maphack definition of model replacement dynamic rotation for any [[sprite]], using five members of the [[Members of the spriteext structure|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.) | |||
==Tutorial== | |||
[[Image:axis.png]] | [[Image:axis.png]] | ||
While the | 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 | 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: | ||
[[Image:roll.png]] | [[Image:roll.png]] | ||
If you put a - | 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: | ||
[[Image:zoff.png]] | [[Image:zoff.png]] | ||
[[Category:Sprite manipulation]] |
Latest revision as of 10:27, 16 November 2012
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.)
Tutorial
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: