예제 #1
0
        public void UpdatePosition(Vector3 centrePos, Quaternion referenceTransform)
        {
            Vector3 xOffset = new Vector3(0.25f, 0f, 0f);
            Vector3 yOffset = new Vector3(0f, 0.25f, 0f);
            Vector3 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));
        }
예제 #2
0
        public void UpdateRotation(Vector3 startPos, Quaternion referenceTransform, Quaternion inputQuat)
        {
            Vector3 vec3   = new Vector3(3f, 3f, 3f);
            Vector3 vec15  = new Vector3(1.5f, 1.5f, 1.5f);
            Vector3 vec05  = new Vector3(0.5f, 0.5f, 0.5f);
            Vector3 vec025 = new Vector3(0.25f, 0.25f, 0.25f);
            float   inputTheta;
            Vector3 inputAxis;

            inputQuat.ToAngleAxis(out inputTheta, out inputAxis);
            //Rotate so unrotated is up.
            Vector3 upVector = FlightGlobals.upAxis;
            //Theta stuff
            Vector3 thetaStart     = startPos + (Vector3.Scale(referenceTransform * inputAxis, vec15));
            Vector3 refDirection   = Vector3.up;
            float   thetaX         = Mathf.Sin(inputTheta * Mathf.Deg2Rad);
            float   thetaY         = Mathf.Cos(inputTheta * Mathf.Deg2Rad);
            Vector3 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));
        }