예제 #1
0
 public void UpdatePosition(Vector3 centrePos, Quaternion referenceTransform)
 {
     var xOffset = new Vector3(0.25f, 0f, 0f);
     var yOffset = new Vector3(0f, 0.25f, 0f);
     var zOffset = new Vector3(0f, 0f, 0.25f);
     _xAxis.UpdatePosition(centrePos - referenceTransform * xOffset, centrePos + referenceTransform * xOffset);
     _yAxis.UpdatePosition(centrePos - referenceTransform * yOffset, centrePos + referenceTransform * yOffset);
     _zAxis.UpdatePosition(centrePos - referenceTransform * zOffset, centrePos + referenceTransform * zOffset);
 }
        public void UpdateRotation(Vector3 startPos, Quaternion referenceTransform, Quaternion inputQuat)
        {
            var vec3   = new Vector3(3f, 3f, 3f);
            var vec15  = new Vector3(1.5f, 1.5f, 1.5f);
            var vec05  = new Vector3(0.5f, 0.5f, 0.5f);
            var vec025 = new Vector3(0.25f, 0.25f, 0.25f);

            inputQuat.ToAngleAxis(out var inputTheta, out var inputAxis);

            //Theta stuff
            var thetaStart     = startPos + Vector3.Scale(referenceTransform * inputAxis, vec15);
            var refDirection   = Vector3.up;
            var thetaX         = Mathf.Sin(inputTheta * Mathf.Deg2Rad);
            var thetaY         = Mathf.Cos(inputTheta * Mathf.Deg2Rad);
            var thetaDirection = new Vector3(thetaX, thetaY, 0f);

            _axis.UpdatePosition(startPos, startPos + Vector3.Scale(referenceTransform * inputAxis, vec3));
            _reference0.UpdatePosition(thetaStart, thetaStart + Vector3.Scale(referenceTransform * refDirection, vec025));
            _theta.UpdatePosition(thetaStart, thetaStart + Vector3.Scale(referenceTransform * thetaDirection, vec05));
        }