private static void SendRotation( Entity3d target, float delta ) { float s = ( float )Math.Atan2( target.Ahead.Z, target.Ahead.X ); s = Utils.Wrap( s + delta, 0, ( float )( 2 * Math.PI ) ); target.HandleMessage( new RotateXzRequest( s ) ); }
/// <summary> /// Cheats and forces the entity to look at a given point /// </summary> private void SendLookAt( Entity3d target, Point3 pos ) { m_LookAt = pos; /* Vector3 ahead = ( pos - target.NextPosition ); ahead.Y = 0; float aheadLength = ahead.Length; if ( aheadLength < 0.001f ) { return; } ahead /= aheadLength; Vector3 left = Vector3.Cross( target.Up, ahead ).MakeNormal( ); target.SetFrame( left, target.Up, ahead ); */ }
/// <summary> /// Sends a movement message to the specified target /// </summary> private static void SendMovement( Entity3d target, Vector3 move ) { // Turn movement into units per second (irrespective of clock update rate) move *= ( float )TinyTime.ToSeconds( target.CurrentPosition.LastStepInterval ); target.HandleMessage( new MovementXzRequest( move.X, move.Z ) ); }