Beispiel #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");
     }
 }
Beispiel #2
0
 /// <summary>
 /// Gets a future position for this entity, regarless of wheter it's orbit or newtonion trajectory
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="atDateTime"></param>
 /// <param name="ralitive"></param>
 /// <returns>In Meters</returns>
 /// <exception cref="Exception"></exception>
 public static Vector3 GetPosition_m(Entity entity, DateTime atDateTime, bool ralitive = true)
 {
     if (entity.HasDataBlob<OrbitDB>())
     {
         if (ralitive)
             return OrbitProcessor.GetPosition_m(entity.GetDataBlob<OrbitDB>(), atDateTime);
         else
             return OrbitProcessor.GetAbsolutePosition_m(entity.GetDataBlob<OrbitDB>(), atDateTime);
     }
     else if (entity.HasDataBlob<NewtonMoveDB>())
     {
         if (ralitive)
             return  NewtonionMovementProcessor.GetPositon_m(entity, entity.GetDataBlob<NewtonMoveDB>(), atDateTime).pos;
         else
             return NewtonionMovementProcessor.GetAbsulutePositon_m(entity, entity.GetDataBlob<NewtonMoveDB>(), atDateTime).pos;
         
     }
     else if (entity.HasDataBlob<PositionDB>())
     {
         if(ralitive)
             return entity.GetDataBlob<PositionDB>().RelativePosition_m;
         else
             return entity.GetDataBlob<PositionDB>().AbsolutePosition_m;
     }
     else
     {
         throw new Exception("Entity is positionless");
     }
 }