Topic: deltayaw/roll/pitch?
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.
GMan's Mods & Stuff → Requests → deltayaw/roll/pitch?
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.
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
Dont know if this works, cos to be honest Ive never used DeltaYaw or DeltaPitch. And I dont think there is a Delta Roll.
But anyway you should be able to see what I have tried to do, and fix it so that it works.
@Gman
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
thx H&K have no idea if it works or not. here is some code i found on the Irrlicht forums that i was going to use as a basis for the ib3d functions. it will be interesting to compare the two.
// 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& missilePosition, core::vector3df& missileRotation, core::vector3df& 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's local space
rotMatrix.getInverse( invRotMatrix );
// transform the target vector into missile'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 < 0.0f )
deltaRoll += 360.0f;
if( deltaRoll >= 360.0f )
deltaRoll -= 360.0f;
if( deltaRoll > 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;
}
GMan's Mods & Stuff → Requests → deltayaw/roll/pitch?
Powered by PunBB, supported by Informer Technologies, Inc.