protected void CheckForPositionChanges()
        {
            var position = transform.position;

            if (expectedPositionSet == true)
            {
                if (expectedPosition.x != position.x || expectedPosition.y != position.y || expectedPosition.z != position.z)
                {
                    Position.LocalX += position.x - expectedPosition.x;
                    Position.LocalY += position.y - expectedPosition.y;
                    Position.LocalZ += position.z - expectedPosition.z;

                    Position.SnapLocal();

                    expectedPosition = position;

                    PositionChanged();
                }
            }
            else
            {
                expectedPositionSet = true;
                expectedPosition    = position;
            }
        }
Exemple #2
0
        /// <summary>Allows you to warp to the target point with the specified separation distance.</summary>
        public void WarpTo(SgtPosition position, double distance)
        {
            // Make sure we don't warp directly onto the star
            var direction = SgtPosition.Direction(ref Point.Position, ref position);

            position.LocalX -= direction.x * distance;
            position.LocalY -= direction.y * distance;
            position.LocalZ -= direction.z * distance;
            position.SnapLocal();

            WarpTo(position);
        }