<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[GMan's Mods & Stuff — deltayaw/roll/pitch?]]></title>
		<link>https://gprogs.com/viewtopic.php?id=170</link>
		<atom:link href="https://gprogs.com/extern.php?action=feed&amp;tid=170&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in deltayaw/roll/pitch?.]]></description>
		<lastBuildDate>Fri, 23 Mar 2007 02:05:20 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: deltayaw/roll/pitch?]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=668#p668</link>
			<description><![CDATA[<p>thx H&amp;K <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" />&nbsp; have no idea if it works or not.&nbsp; here is some code i found on the Irrlicht forums that i was going to use as a basis for the ib3d functions.&nbsp; it will be interesting to compare the two.<br /></p><div class="codebox"><pre><code>// by Xaron: http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=11333
/** 
 * @brief guided missile steering helper function 
 * 
 * @param missilePosition - current absolute position of the missile 
 * @param missileRotation - current absolute rotation of the missile 
 * @param targetPosition  - current absolute target position 
 * @param oversteer       - oversteer factor in degrees 
 * 
 * @return targetPitchRoll - delta pitch (x) and delta roll (z) values to the target 
 * 
 *******************************************************************************************************/core::vector3df getToTargetPitchRoll( core::vector3df&amp; missilePosition, core::vector3df&amp; missileRotation, core::vector3df&amp; targetPosition, float oversteer = 0.0f ) 
{ 
  core::matrix4 rotMatrix, invRotMatrix; 
  rotMatrix.setRotationDegrees( missileRotation ); 
  core::vector3df targetPitchRoll( 0.0f, 0.0f, 0.0f ); 
  // get the current missile direction 
  core::vector3df currentMissileTargetVec( 0.0f, 0.0f, 1.0f ); 

  // get the vector to the target (from the missile position) 
  core::vector3df missileTargetVec = ( targetPosition - missilePosition ).normalize(); 
  // invert the rotation matrix to transform the target vector into the missile&#039;s local space 
  rotMatrix.getInverse( invRotMatrix ); 
  // transform the target vector into missile&#039;s local space 
  invRotMatrix.rotateVect( missileTargetVec ); 
  // compute the roll angle to the target 
  float deltaRoll = atan2f( missileTargetVec.Y, missileTargetVec.X ) * core::RADTODEG - 90.0f; 
  if( deltaRoll &lt; 0.0f ) 
    deltaRoll += 360.0f; 
  if( deltaRoll &gt;= 360.0f ) 
    deltaRoll -= 360.0f; 

  if( deltaRoll &gt; 180.0f ) 
    deltaRoll -= 360.0f; 

  // compute the pitch angle to the target 
  float deltaPitch = acosf( currentMissileTargetVec.dotProduct( missileTargetVec ) ) 
    * core::RADTODEG + oversteer; 

  targetPitchRoll.X = -deltaPitch; 
  targetPitchRoll.Z = deltaRoll; 

  return targetPitchRoll; 
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (gman)]]></author>
			<pubDate>Fri, 23 Mar 2007 02:05:20 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=668#p668</guid>
		</item>
		<item>
			<title><![CDATA[Re: deltayaw/roll/pitch?]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=667#p667</link>
			<description><![CDATA[<div class="codebox"><pre><code>Import irrlicht.b3d

Function ib3d_DeltaYaw:Float(Entity1:ib3d_Entity,Entity2:ib3d_Entity)

    Local TempRotation:Vector3df = entity1._node.GetRotation()
    
    entity1.Point (Entity2)
    
    Local DeltaYaw:Int = Entity1._node.GetRotation().getY() -TempRotation.getY()
    
    Entity1._node.SetRotation(TempRotation)    
    
    Return DeltaYaw
    
End Function

Function ib3d_DeltaPitch:Float(Entity1:ib3d_Entity,Entity2:ib3d_Entity)

    Local TempRotation:Vector3df = entity1._node.GetRotation()
    
    entity1.Point (Entity2)
    
    Local DeltaPitch:Int = Entity1._node.GetRotation().getX()-TempRotation.getX()
    
    Entity1._node.SetRotation(TempRotation)    
    
    Return DeltaPitch
    
End Function</code></pre></div><p>Dont know if this works, cos to be honest Ive never used DeltaYaw or DeltaPitch. And I dont think there is a Delta Roll.</p><p>But anyway you should be able to see what I have tried to do, and fix it so that it works.</p><p>@Gman<br />Obviously they should be Methods of entity and then wrapper functions , but I didnt want to confuse the issue. Also there is probably some realy easy way deep in irrlicht. But haha, it killed ten minutes <img src="https://gprogs.com/img/smilies/wink.png" width="15" height="15" alt="wink" /></p>]]></description>
			<author><![CDATA[null@example.com (H&K)]]></author>
			<pubDate>Fri, 23 Mar 2007 01:50:35 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=667#p667</guid>
		</item>
		<item>
			<title><![CDATA[deltayaw/roll/pitch?]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=666#p666</link>
			<description><![CDATA[<p>Is their any chance these commands will get added to irrB3d, i used them alot in my b3d project and pretty much need them in this.</p>]]></description>
			<author><![CDATA[null@example.com (sinu)]]></author>
			<pubDate>Fri, 23 Mar 2007 00:24:53 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=666#p666</guid>
		</item>
	</channel>
</rss>
