Пример #1
0
        private Quaternion CalculateNewTrackRotation(TrackSection newPiece, bool invertNewPiece)
        {
            Quaternion anchorRotation = Inverted ? Helper.InvertTrackRotation(CurrentSection.Rotation) : CurrentSection.GetRotationOnTrack(CurrentSection.Length);
            //Debug.LogFormat("Anchor rotation: {0}, Inverted: {1}", anchorRotation.eulerAngles, Inverted);
            Quaternion newRotation = invertNewPiece ? Helper.InvertTrackRotation(newPiece.GetRotationOnTrack(newPiece.Length)) : Quaternion.identity;

            //Debug.LogFormat("New piece rotation: {0}, Inverted: {1}", newRotation.eulerAngles, invertNewPiece);
            //Debug.LogFormat("Total rotation: {0}", (anchorRotation * newRotation).eulerAngles);
            return(anchorRotation * newRotation);
        }