Esempio n. 1
0
 /// <summary>
 ///     Converts a FixedPointVector3 to a Coordinates value.
 /// </summary>
 /// <remarks>
 ///     Converts each component from a Q21.10 fixed point value to a double.
 /// </remarks>
 internal static Coordinates ToCoordinates(this FixedPointVector3 fixedPointVector3)
 {
     return(new Coordinates
     {
         X = FixedToFloat(fixedPointVector3.X),
         Y = FixedToFloat(fixedPointVector3.Y),
         Z = FixedToFloat(fixedPointVector3.Z)
     });
 }
Esempio n. 2
0
 /// <summary>
 ///     Converts a FixedPointVector3 to a Unity Vector3.
 /// </summary>
 /// <remarks>
 ///     Converts each component from a Q21.10 fixed point value to a float.
 /// </remarks>
 internal static UnityEngine.Vector3 ToUnityVector3(FixedPointVector3 fixedPointVector3)
 {
     return(new Vector3
     {
         x = FixedToFloat(fixedPointVector3.X),
         y = FixedToFloat(fixedPointVector3.Y),
         z = FixedToFloat(fixedPointVector3.Z)
     });
 }
Esempio n. 3
0
 public static void Serialize(FixedPointVector3 instance, global::Improbable.Worker.CInterop.SchemaObject obj)
 {
     {
         obj.AddSint32(1, instance.X);
     }
     {
         obj.AddSint32(2, instance.Y);
     }
     {
         obj.AddSint32(3, instance.Z);
     }
 }
Esempio n. 4
0
 /// <summary>
 ///     Utility method for creating a TransformInternal Snapshot.
 /// </summary>
 /// <param name="location">
 ///     The location of an entity, given as a Unity Vector3.
 /// </param>
 /// <param name="rotation">
 ///     The rotation of an entity, given as a Unity Quaternion.
 /// </param>
 /// <param name="velocity">
 ///     The velocity of an entity, given as a Unity Vector3.
 /// </param>
 /// <remarks>
 ///     This method populates a TransformInternal with compressed representations of the given arguments.
 /// </remarks>
 public static TransformInternal.Snapshot CreateTransformSnapshot(
     Vector3 location    = default,
     Quaternion rotation = default,
     Vector3 velocity    = default)
 {
     return(new TransformInternal.Snapshot
     {
         Location = FixedPointVector3.FromUnityVector(location),
         Rotation = CompressedQuaternion.FromUnityQuaternion(rotation),
         Velocity = FixedPointVector3.FromUnityVector(velocity),
         TicksPerSecond = 1f / Time.fixedDeltaTime
     });
 }
Esempio n. 5
0
            public static FixedPointVector3 Deserialize(global::Improbable.Worker.CInterop.SchemaObject obj)
            {
                var instance = new FixedPointVector3();

                {
                    instance.X = obj.GetSint32(1);
                }
                {
                    instance.Y = obj.GetSint32(2);
                }
                {
                    instance.Z = obj.GetSint32(3);
                }
                return(instance);
            }
Esempio n. 6
0
 /// <summary>
 ///     Extension method for converting a Unity Vector to a FixedPointVector3.
 /// </summary>
 public static FixedPointVector3 ToFixedPointVector3(this Vector3 unityVector)
 {
     return(FixedPointVector3.FromUnityVector(unityVector));
 }
Esempio n. 7
0
 public bool Equals(FixedPointVector3 other)
 {
     return(X == other.X && Y == other.Y && Z == other.Z);
 }
Esempio n. 8
0
 /// <summary>
 ///     Returns whether two FixedPointVector3 variables are different.
 /// </summary>
 internal static bool HasChanged(FixedPointVector3 a, FixedPointVector3 b)
 {
     return(a.X != b.X || a.Y != b.Y || a.Z != b.Z);
 }