/// <summary> /// Called automatically to update positional data when the offset of the FloatingOrigin changes /// </summary> /// <param name="sceneCenter"></param> public virtual void OnOriginChange(WorldPosition sceneCenter) { UpdateUnityPosition(sceneCenter); }
public void Start() { FloatingOrigin.Add(this); this.worldPosition = new WorldPosition(this.unityPosition); UpdateColliderList(); }
public static WorldPosition operator -(WorldPosition a, WorldPosition b) { WorldPosition p = new WorldPosition(a.sectorOffset - b.sectorOffset, a.sector - b.sector); return(p); }
public WorldPosition(WorldPosition other) : this() { this.sector = new Long3(other.sector); this.sectorOffset = new Vector3(other.sectorOffset.x, other.sectorOffset.y, other.sectorOffset.z); }
public static double SqrDistance(WorldPosition a, WorldPosition b) { return((b - a).sqrMagnitude); }
public static double Distance(WorldPosition a, WorldPosition b) { return((b - a).magnitude); }
/// <summary> /// Check if two another world position occupies the same sector of space /// </summary> /// <param name="other"></param> /// <returns></returns> public bool SameSector(WorldPosition other) { return(this.sector == other.sector); }
/// <summary> /// Called automatically when the object's world position sector exits the floating origin's center sector /// </summary> /// <param name="sceneCenter"></param> public virtual void OnOriginExit(WorldPosition sceneCenter) { }
/// <summary> /// Called automatically when the WorldPosition changes from one sector to another /// </summary> /// <param name="old"></param> /// <param name="new"></param> public virtual void OnSectorChange(WorldPosition oldPosition, WorldPosition newPosition) { }