예제 #1
0
파일: PDUs.cs 프로젝트: DuckbearLab/UniSim
 public void CopyFrom(EntityStatePDU other)
 {
     EntityId                         = other.EntityId;
     ForceId                          = other.ForceId;
     EntityType                       = other.EntityType;
     AlternativeEntityType            = other.AlternativeEntityType;
     LinearVelocity                   = other.LinearVelocity;
     Location                         = other.Location;
     Orientation                      = other.Orientation;
     Appearance.BitValue              = other.Appearance.BitValue;
     DeadRecokning.Algorithm          = other.DeadRecokning.Algorithm;
     DeadRecokning.LinearAcceleration = other.DeadRecokning.LinearAcceleration;
     MarkingText.CharacterSet         = other.MarkingText.CharacterSet;
     MarkingText.String               = other.MarkingText.String;
     Capabilities                     = other.Capabilities;
     if (ArticulatedParts.Length != other.ArticulatedParts.Length)
     {
         ArticulatedParts = new ArticulatedPart[other.ArticulatedParts.Length];
     }
     for (int i = 0; i < other.ArticulatedParts.Length; i++)
     {
         ArticulatedParts[i].TypeDesignator         = other.ArticulatedParts[i].TypeDesignator;
         ArticulatedParts[i].ChangeIndicator        = other.ArticulatedParts[i].ChangeIndicator;
         ArticulatedParts[i].TypeVariantAttached    = other.ArticulatedParts[i].TypeVariantAttached;
         ArticulatedParts[i].TypeVariantArticulated = other.ArticulatedParts[i].TypeVariantArticulated;
         ArticulatedParts[i].value = other.ArticulatedParts[i].value;
     }
 }
예제 #2
0
 public Vector3Float(Vector3Float other)
 {
     X = other.X;
     Y = other.Y;
     Z = other.Z;
 }
예제 #3
0
        public static void Calculate(EntityStatePDU entityState, float elapsedTime, out GeocentricCoord outLocation, out Vector3Float outOrientation)
        {
            switch (entityState.DeadRecokning.Algorithm)
            {
            case DeadReckoningAlgorithm.Other:
            case DeadReckoningAlgorithm.Static:
                outLocation    = (GeocentricCoord)entityState.Location;
                outOrientation = entityState.Orientation;
                return;

            case DeadReckoningAlgorithm.FPW:
                outLocation    = (GeocentricCoord)(entityState.Location + entityState.LinearVelocity * elapsedTime);
                outOrientation = entityState.Orientation;
                return;

            case DeadReckoningAlgorithm.RPW:
                outLocation    = (GeocentricCoord)(entityState.Location + entityState.LinearVelocity * elapsedTime);
                outOrientation = entityState.Orientation + entityState.DeadRecokning.AngularVelocity * elapsedTime;
                return;

            case DeadReckoningAlgorithm.RVW:
                outLocation    = (GeocentricCoord)(entityState.Location + (entityState.LinearVelocity * elapsedTime + entityState.DeadRecokning.LinearAcceleration * (0.5 * elapsedTime * elapsedTime)));
                outOrientation = entityState.Orientation + entityState.DeadRecokning.AngularVelocity * elapsedTime;
                return;

            case DeadReckoningAlgorithm.FVW:
                outLocation    = (GeocentricCoord)(entityState.Location + (entityState.LinearVelocity * elapsedTime + entityState.DeadRecokning.LinearAcceleration * (0.5 * elapsedTime * elapsedTime)));
                outOrientation = entityState.Orientation;
                return;
            }

            outLocation    = (GeocentricCoord)entityState.Location;
            outOrientation = entityState.Orientation;
        }