<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.eduke32.com/w/index.php?action=history&amp;feed=atom&amp;title=How_to_Make_Models_Pitch</id>
	<title>How to Make Models Pitch - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.eduke32.com/w/index.php?action=history&amp;feed=atom&amp;title=How_to_Make_Models_Pitch"/>
	<link rel="alternate" type="text/html" href="https://wiki.eduke32.com/w/index.php?title=How_to_Make_Models_Pitch&amp;action=history"/>
	<updated>2026-07-07T12:10:49Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.47.0-alpha</generator>
	<entry>
		<id>https://wiki.eduke32.com/w/index.php?title=How_to_Make_Models_Pitch&amp;diff=7720&amp;oldid=prev</id>
		<title>Hendricks266: grammar (spacing, commas, colons, terminology, capitalization, et cetera), pre tag replacement because it disables formatting (like bold)</title>
		<link rel="alternate" type="text/html" href="https://wiki.eduke32.com/w/index.php?title=How_to_Make_Models_Pitch&amp;diff=7720&amp;oldid=prev"/>
		<updated>2009-02-21T16:51:55Z</updated>

		<summary type="html">&lt;p&gt;grammar (spacing, commas, colons, terminology, capitalization, et cetera), pre tag replacement because it disables formatting (like bold)&lt;/p&gt;
&lt;a href=&quot;https://wiki.eduke32.com/w/index.php?title=How_to_Make_Models_Pitch&amp;amp;diff=7720&amp;amp;oldid=7718&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Hendricks266</name></author>
	</entry>
	<entry>
		<id>https://wiki.eduke32.com/w/index.php?title=How_to_Make_Models_Pitch&amp;diff=7718&amp;oldid=prev</id>
		<title>The Commander at 12:53, 20 February 2009</title>
		<link rel="alternate" type="text/html" href="https://wiki.eduke32.com/w/index.php?title=How_to_Make_Models_Pitch&amp;diff=7718&amp;oldid=prev"/>
		<updated>2009-02-20T12:53:00Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 05:53, 20 February 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;As we know the build engine has limits of that it can not pitch 2D sprites (think of a picture hanging on a crooked) but we can exploit this by using 3D models plus the structure members &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;pitch &lt;/del&gt;and &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;roll.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;As we know the build engine has limits of that it can not pitch 2D sprites (think of a picture hanging on a &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;wall &lt;/ins&gt;crooked) but we can exploit this by using 3D models plus the structure members &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Pitch]] &lt;/ins&gt;and &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Roll]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;The following code will allow actors that call the state to pitch and roll if they are placed or move onto a sloped surface. &lt;/del&gt;It is best to use the code as a state so that every actor is not using it, other wise it could have a &quot;serious&quot; impact on your frame rate. (not to mention that certain actors would just look bad using this code)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;It is best to use the code as a state so that every actor is not using it, other wise it could have a &quot;serious&quot; impact on your frame rate. (not to mention that certain actors would just look bad using this code)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;The following code will allow actors that call the state to pitch and roll if they are placed or move onto a sloped surface. &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Note: This code should be placed at the top of GAME.CON or at least called first before any actors call the state.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Note: This code should be placed at the top of GAME.CON or at least called first before any actors call the state.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>The Commander</name></author>
	</entry>
	<entry>
		<id>https://wiki.eduke32.com/w/index.php?title=How_to_Make_Models_Pitch&amp;diff=7717&amp;oldid=prev</id>
		<title>The Commander: Added a Tut from Dr. Kylstien code.</title>
		<link rel="alternate" type="text/html" href="https://wiki.eduke32.com/w/index.php?title=How_to_Make_Models_Pitch&amp;diff=7717&amp;oldid=prev"/>
		<updated>2009-02-20T12:45:31Z</updated>

		<summary type="html">&lt;p&gt;Added a Tut from Dr. Kylstien code.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;As we know the build engine has limits of that it can not pitch 2D sprites (think of a picture hanging on a crooked) but we can exploit this by using 3D models plus the structure members pitch and roll.&lt;br /&gt;
&lt;br /&gt;
The following code will allow actors that call the state to pitch and roll if they are placed or move onto a sloped surface. It is best to use the code as a state so that every actor is not using it, other wise it could have a &amp;quot;serious&amp;quot; impact on your frame rate. (not to mention that certain actors would just look bad using this code)&lt;br /&gt;
&lt;br /&gt;
Note: This code should be placed at the top of GAME.CON or at least called first before any actors call the state.&lt;br /&gt;
&lt;br /&gt;
First off, we will need the following gamevars&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gamevar a	0 0&lt;br /&gt;
gamevar b	0 0&lt;br /&gt;
gamevar x	0 0&lt;br /&gt;
gamevar y	0 0&lt;br /&gt;
gamevar z	0 0&lt;br /&gt;
gamevar angle	0 0&lt;br /&gt;
gamevar SECTOR	0 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to define two things.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
define TILT_SPEED 32&lt;br /&gt;
define TILT_MAX 128 // This value maybe edited if more slope is required.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the code its self.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
state pitchroll {&lt;br /&gt;
	iffloordistl 8&lt;br /&gt;
	{&lt;br /&gt;
		// get z behind? actor&lt;br /&gt;
		getactor[THISACTOR].x x&lt;br /&gt;
		getactor[THISACTOR].y y&lt;br /&gt;
		getactor[THISACTOR].z z&lt;br /&gt;
		getactor[THISACTOR].ang angle&lt;br /&gt;
		getactor[THISACTOR].clipdist a&lt;br /&gt;
		mulvar a -1 addvarvar a x&lt;br /&gt;
		rotatepoint x y a y angle x y&lt;br /&gt;
		updatesectorz x y z SECTOR&lt;br /&gt;
		ifvarn SECTOR -1 { //make sure calculated point is in a SECTOR&lt;br /&gt;
			getflorzofslope SECTOR x y b&lt;br /&gt;
		} else {&lt;br /&gt;
			getactor[THISACTOR].z b&lt;br /&gt;
		}&lt;br /&gt;
		// get z in front? of actor&lt;br /&gt;
		getactor[THISACTOR].x x&lt;br /&gt;
		getactor[THISACTOR].y y&lt;br /&gt;
		getactor[THISACTOR].clipdist a&lt;br /&gt;
		addvarvar a x&lt;br /&gt;
		rotatepoint x y a y angle x y&lt;br /&gt;
		updatesectorz x y z SECTOR&lt;br /&gt;
		ifvarn SECTOR -1 {&lt;br /&gt;
			getflorzofslope SECTOR x y z&lt;br /&gt;
		} else {&lt;br /&gt;
			getactor[THISACTOR].z z&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// get pitch amount&lt;br /&gt;
		subvarvar z b&lt;br /&gt;
		shiftvarr z 3&lt;br /&gt;
		&lt;br /&gt;
		// cap amount of pitch, Duke looks silly leaning out so far&lt;br /&gt;
		ifvarg z TILT_MAX setvar z TILT_MAX&lt;br /&gt;
		setvar a TILT_MAX mulvar a -1&lt;br /&gt;
		ifvarvarl z a setvarvar z a&lt;br /&gt;
		&lt;br /&gt;
		// gradually adjust pitch to avoid jerkily snapping to the slope&lt;br /&gt;
		getactor[THISACTOR].pitch a&lt;br /&gt;
		ifvarvarg a z {&lt;br /&gt;
			subvar a TILT_SPEED&lt;br /&gt;
			setactor[THISACTOR].pitch a&lt;br /&gt;
		} else ifvarvarg a z {&lt;br /&gt;
			setactor[THISACTOR].pitch z&lt;br /&gt;
		}&lt;br /&gt;
		ifvarvarl a z {&lt;br /&gt;
			addvar a TILT_SPEED&lt;br /&gt;
			setactor[THISACTOR].pitch a&lt;br /&gt;
		} else ifvarvarl a z {&lt;br /&gt;
			setactor[THISACTOR].pitch z&lt;br /&gt;
		}	&lt;br /&gt;
		&lt;br /&gt;
		// get z right? of actor&lt;br /&gt;
		getactor[THISACTOR].x x&lt;br /&gt;
		getactor[THISACTOR].y y&lt;br /&gt;
		getactor[THISACTOR].z z&lt;br /&gt;
		getactor[THISACTOR].ang angle&lt;br /&gt;
		getactor[THISACTOR].clipdist a&lt;br /&gt;
		addvarvar a y&lt;br /&gt;
		rotatepoint x y x a angle x y&lt;br /&gt;
		updatesectorz x y z SECTOR&lt;br /&gt;
		ifvarn SECTOR -1 {&lt;br /&gt;
			getflorzofslope SECTOR x y b&lt;br /&gt;
		} else {&lt;br /&gt;
			getactor[THISACTOR].z b&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// get left? of actor&lt;br /&gt;
		getactor[THISACTOR].x x&lt;br /&gt;
		getactor[THISACTOR].y y&lt;br /&gt;
		getactor[THISACTOR].clipdist a&lt;br /&gt;
		mulvar a -1 addvarvar a y&lt;br /&gt;
		rotatepoint x y x a angle x y&lt;br /&gt;
		updatesectorz x y z SECTOR&lt;br /&gt;
		ifvarn SECTOR -1 {&lt;br /&gt;
			getflorzofslope SECTOR x y z&lt;br /&gt;
		} else {&lt;br /&gt;
			getactor[THISACTOR].z z&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// get roll amount&lt;br /&gt;
		subvarvar z b&lt;br /&gt;
		shiftvarr z 3&lt;br /&gt;
		&lt;br /&gt;
		// cap amount of roll&lt;br /&gt;
		ifvarg z TILT_MAX setvar z TILT_MAX&lt;br /&gt;
		setvar a TILT_MAX mulvar a -1&lt;br /&gt;
		ifvarvarl z a setvarvar z a&lt;br /&gt;
		&lt;br /&gt;
		// gradually adjust roll&lt;br /&gt;
		getactor[THISACTOR].roll a&lt;br /&gt;
		ifvarvarg a z {&lt;br /&gt;
			subvar a TILT_SPEED&lt;br /&gt;
			setactor[THISACTOR].roll a&lt;br /&gt;
		} else ifvarvarg a z {&lt;br /&gt;
			setactor[THISACTOR].roll z&lt;br /&gt;
		}&lt;br /&gt;
		ifvarvarl a z {&lt;br /&gt;
			addvar a TILT_SPEED&lt;br /&gt;
			setactor[THISACTOR].roll a&lt;br /&gt;
		} else ifvarvarl a z {&lt;br /&gt;
			setactor[THISACTOR].roll z&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
} ends&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make use of the state place the following line into any actor that will use it. For example I will use the chaingun.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
actor CHAINGUNSPRITE&lt;br /&gt;
  fall&lt;br /&gt;
  state pitchroll // This is where I have placed the state&lt;br /&gt;
  ifmove RESPAWN_ACTOR_FLAG&lt;br /&gt;
    state respawnit&lt;br /&gt;
  else&lt;br /&gt;
    ifp pshrunk nullop&lt;br /&gt;
    else&lt;br /&gt;
      ifp palive&lt;br /&gt;
        ifpdistl RETRIEVEDISTANCE&lt;br /&gt;
          ifcount 6&lt;br /&gt;
            ifcanseetarget&lt;br /&gt;
      {&lt;br /&gt;
        ifgotweaponce 0&lt;br /&gt;
          break&lt;br /&gt;
&lt;br /&gt;
        addweapon CHAINGUN_WEAPON 50&lt;br /&gt;
        quote 54&lt;br /&gt;
        ifspawnedby CHAINGUNSPRITE&lt;br /&gt;
          state getweaponcode&lt;br /&gt;
        else&lt;br /&gt;
          state quikweaponget&lt;br /&gt;
      }&lt;br /&gt;
enda&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>The Commander</name></author>
	</entry>
</feed>