示例#1
0
 public static Vector3 GetVelocity_m(Entity entity, DateTime atDateTime, bool ralitive = true)
 {
     if (entity.HasDataBlob <OrbitDB>())
     {
         if (ralitive)
         {
             return(OrbitProcessor.InstantaneousOrbitalVelocityVector_m(entity.GetDataBlob <OrbitDB>(), atDateTime));
         }
         else
         {
             return(OrbitProcessor.AbsoluteOrbitalVector_m(entity.GetDataBlob <OrbitDB>(), atDateTime));
         }
     }
     else if (entity.HasDataBlob <NewtonMoveDB>())
     {
         var vel = NewtonionMovementProcessor.GetPositon_m(entity, entity.GetDataBlob <NewtonMoveDB>(), atDateTime).vel;
         if (ralitive)
         {
             return(vel);
         }
         else //recurse
         {
             return(GetVelocity_m(GetSOIParentEntity(entity), atDateTime, false) + vel);
         }
     }
     else
     {
         throw new Exception("Entity has no velocity");
     }
 }
示例#2
0
 /// <summary>
 /// Gets future velocity for this entity, datablob agnostic.
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="atDateTime"></param>
 /// <returns></returns>
 /// <exception cref="Exception"></exception>
 public static Vector3 GetAbsoluteFutureVelocity(Entity entity, DateTime atDateTime)
 {
     if (entity.HasDataBlob <OrbitDB>())
     {
         return(OrbitProcessor.AbsoluteOrbitalVector_m(entity.GetDataBlob <OrbitDB>(), atDateTime));
     }
     if (entity.HasDataBlob <OrbitUpdateOftenDB>())
     {
         return(OrbitProcessor.AbsoluteOrbitalVector_m(entity.GetDataBlob <OrbitUpdateOftenDB>(), atDateTime));
     }
     else if (entity.HasDataBlob <NewtonMoveDB>())
     {
         var vel = NewtonionMovementProcessor.GetRelativeState(entity, entity.GetDataBlob <NewtonMoveDB>(), atDateTime).vel;
         //recurse
         return(GetAbsoluteFutureVelocity(GetSOIParentEntity(entity), atDateTime) + vel);
     }
     else if (entity.HasDataBlob <WarpMovingDB>())
     {
         return(entity.GetDataBlob <WarpMovingDB>().SavedNewtonionVector);
     }
     else
     {
         throw new Exception("Entity has no velocity");
     }
 }