Difference between revisions of "Model rotation"

From EDukeWiki
Jump to navigation Jump to search
 
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Eduke32]] allows [[CON]]-definition of model replacement dynamic rotation for any [[actor]] with the members [[pitch]] and [[roll]].
+
[[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.
[[Image:http://jedinight.free.fr/duke/dev/wiki/axis.png]]
 
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 [[actor]] :
+
'''''pitch''''' and '''''roll''''' contain the values of rotation for the [[actor]]'s model around the X-axis and Y-axis respectively.
[[Image:http://jedinight.free.fr/duke/dev/wiki/roll.png]]
+
 
If you put a -16384 [[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 :
+
'''''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.
[[Image:http://jedinight.free.fr/duke/dev/wiki/zoff.png]]
+
 
 +
The values are expressed in [[Build units]]. (For pitch, -512 looks up while 512 looks down.)
 +
 
 +
==Tutorial==
 +
 
 +
[[Image:axis.png]]
 +
 
 +
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:
 +
 
 +
[[Image:roll.png]]
 +
 
 +
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]]
 +
 
 +
[[Category:Sprite manipulation]]

Latest revision as of 11: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

Axis.png

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:

Roll.png

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:

Zoff.png