BEPUphysics.Constraints.TwoEntity.JointLimits.EllipseSwingLimit.SetupJointTransforms C# (CSharp) Method

SetupJointTransforms() public method

Sets up the joint transforms by automatically creating perpendicular vectors to complete the bases.
public SetupJointTransforms ( System.Vector3 twistAxis ) : void
twistAxis System.Vector3 Axis around which rotation is allowed.
return void
        public void SetupJointTransforms(Vector3 twistAxis)
        {
            //Compute a vector which is perpendicular to the axis.  It'll be added in local space to both connections.
            Vector3 xAxis;
            Vector3.Cross(ref twistAxis, ref Toolbox.UpVector, out xAxis);
            float length = xAxis.LengthSquared();
            if (length < Toolbox.Epsilon)
            {
                Vector3.Cross(ref twistAxis, ref Toolbox.RightVector, out xAxis);
            }

            Vector3 yAxis;
            Vector3.Cross(ref twistAxis, ref xAxis, out yAxis);

            //Put the axes into the joint transform of A.
            basis.rotationMatrix = connectionA.orientationMatrix;
            basis.SetWorldAxes(twistAxis, xAxis, yAxis);


            //Put the axes into the 'joint transform' of B too.
            TwistAxisB = twistAxis;
        }