/// <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) }); }
/// <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) }); }
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); } }
/// <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 }); }
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); }
/// <summary> /// Extension method for converting a Unity Vector to a FixedPointVector3. /// </summary> public static FixedPointVector3 ToFixedPointVector3(this Vector3 unityVector) { return(FixedPointVector3.FromUnityVector(unityVector)); }
public bool Equals(FixedPointVector3 other) { return(X == other.X && Y == other.Y && Z == other.Z); }
/// <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); }