コード例 #1
0
 static public int get_twistLimitSpring(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.CharacterJoint self = (UnityEngine.CharacterJoint)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.twistLimitSpring);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
コード例 #2
0
 static public int set_projectionAngle(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.CharacterJoint self = (UnityEngine.CharacterJoint)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.projectionAngle = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
コード例 #3
0
        public static void DrawJoint(CharacterJoint joint, bool modifiable = true, float alphaMlp = 1f)
        {
            if (joint == null) return;

            Vector3 axis = Vector3.zero;
            if (joint.axis != Vector3.zero) axis = joint.axis.normalized;
            Vector3 swingAxis = Vector3.zero;
            if (joint.swingAxis != Vector3.zero) swingAxis = joint.swingAxis.normalized;
            Vector3 crossAxis = swingAxis;
            if (swingAxis != axis) crossAxis = Vector3.Cross(swingAxis, axis);

            float newLowTwistLimit = DrawJointLimit(joint as Joint, "Low Twist Limit", axis, joint.lowTwistLimit.limit, MlpAlpha(lowTwistColor, alphaMlp), -25, modifiable);
            joint.lowTwistLimit = NewJointLimit(newLowTwistLimit, joint.lowTwistLimit, -180, 180);

            float newHighTwistLimit = joint.highTwistLimit.limit;
            if (newLowTwistLimit != 0 || (newLowTwistLimit == 0 && newHighTwistLimit != 0)) newHighTwistLimit = DrawJointLimit(joint as Joint, "High Twist Limit", axis, joint.highTwistLimit.limit, MlpAlpha(highTwistColor, alphaMlp), 25, modifiable);
            joint.highTwistLimit = NewJointLimit(newHighTwistLimit, joint.highTwistLimit, -180, 180);

            float newSwing1Limit = DrawJointLimit(joint as Joint, "Swing1 Limit", swingAxis, -joint.swing1Limit.limit, MlpAlpha(swing1Color, alphaMlp), 25, false);
            newSwing1Limit = DrawJointLimit(joint as Joint, "Swing1 Limit", swingAxis, -newSwing1Limit, MlpAlpha(swing1Color, alphaMlp), 25, modifiable);
            joint.swing1Limit = NewJointLimit(newSwing1Limit, joint.swing1Limit, 0, 180);

            float newSwing2Limit = DrawJointLimit(joint as Joint, "Swing2 Limit", crossAxis, -joint.swing2Limit.limit, MlpAlpha(swing2Color, alphaMlp), 25, false);
            newSwing2Limit = DrawJointLimit(joint as Joint, "Swing2 Limit", crossAxis, -newSwing2Limit, MlpAlpha(swing2Color, alphaMlp), 25, modifiable);
            joint.swing2Limit = NewJointLimit(newSwing2Limit, joint.swing2Limit, 0, 180);
        }
コード例 #4
0
 static public int get_projectionAngle(IntPtr l)
 {
     try {
         UnityEngine.CharacterJoint self = (UnityEngine.CharacterJoint)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.projectionAngle);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #5
0
 static public int get_swingLimitSpring(IntPtr l)
 {
     try {
         UnityEngine.CharacterJoint self = (UnityEngine.CharacterJoint)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.swingLimitSpring);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #6
0
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.CharacterJoint o;
			o=new UnityEngine.CharacterJoint();
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
コード例 #7
0
 static public int get_targetAngularVelocity(IntPtr l)
 {
     try {
         UnityEngine.CharacterJoint self = (UnityEngine.CharacterJoint)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.targetAngularVelocity);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #8
0
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.CharacterJoint o;
         o=new UnityEngine.CharacterJoint();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
コード例 #9
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.CharacterJoint o;
         o = new UnityEngine.CharacterJoint();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #10
0
 static public int set_rotationDrive(IntPtr l)
 {
     try {
         UnityEngine.CharacterJoint self = (UnityEngine.CharacterJoint)checkSelf(l);
         UnityEngine.JointDrive     v;
         checkValueType(l, 2, out v);
         self.rotationDrive = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #11
0
 static public int set_swingAxis(IntPtr l)
 {
     try {
         UnityEngine.CharacterJoint self = (UnityEngine.CharacterJoint)checkSelf(l);
         UnityEngine.Vector3        v;
         checkType(l, 2, out v);
         self.swingAxis = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #12
0
 static public int set_enableProjection(IntPtr l)
 {
     try {
         UnityEngine.CharacterJoint self = (UnityEngine.CharacterJoint)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.enableProjection = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #13
0
 static public int set_targetRotation(IntPtr l)
 {
     try {
         UnityEngine.CharacterJoint self = (UnityEngine.CharacterJoint)checkSelf(l);
         UnityEngine.Quaternion     v;
         checkType(l, 2, out v);
         self.targetRotation = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #14
0
 static public int set_projectionAngle(IntPtr l)
 {
     try {
         UnityEngine.CharacterJoint self = (UnityEngine.CharacterJoint)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.projectionAngle = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #15
0
 static public int set_swingLimitSpring(IntPtr l)
 {
     try {
         UnityEngine.CharacterJoint       self = (UnityEngine.CharacterJoint)checkSelf(l);
         UnityEngine.SoftJointLimitSpring v;
         checkValueType(l, 2, out v);
         self.swingLimitSpring = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #16
0
    public void CopyValuesAndDestroyJoint(CharacterJoint characterJoint)
    {
        ConnectedBody = characterJoint.connectedBody;
        Anchor = characterJoint.anchor;
        Axis = characterJoint.axis;
        AutoConfigureConnectedAnchor = characterJoint.autoConfigureConnectedAnchor;
        ConnectedAnchor = characterJoint.connectedAnchor;
        SwingAxis = characterJoint.swingAxis;
        LowTwistLimit = characterJoint.lowTwistLimit;
        HighTwistLimit = characterJoint.highTwistLimit;
        Swing1Limit = characterJoint.swing1Limit;
        Swing2Limit = characterJoint.swing2Limit;
        BreakForce = characterJoint.breakForce;
        BreakTorque = characterJoint.breakTorque;
        EnableCollision = characterJoint.enableCollision;

        Destroy(characterJoint);
    }
コード例 #17
0
        /// <summary>
        /// Replaces a CharacterJoint with a ConfigurableJoint.
        /// </summary>
        public static void CharacterToConfigurable(CharacterJoint src)
        {
            #if UNITY_EDITOR
            ConfigurableJoint conf = UnityEditor.Undo.AddComponent(src.gameObject, typeof(ConfigurableJoint)) as ConfigurableJoint;
            #else
            ConfigurableJoint conf = src.gameObject.AddComponent<ConfigurableJoint>();
            #endif

            ConvertJoint(ref conf, src as Joint);

            conf.secondaryAxis = src.swingAxis;

            conf.xMotion = ConfigurableJointMotion.Locked;
            conf.yMotion = ConfigurableJointMotion.Locked;
            conf.zMotion = ConfigurableJointMotion.Locked;

            conf.angularXMotion = ConfigurableJointMotion.Limited;
            conf.angularYMotion = ConfigurableJointMotion.Limited;
            conf.angularZMotion = ConfigurableJointMotion.Limited;

            conf.highAngularXLimit = CopyLimit(src.highTwistLimit);
            conf.lowAngularXLimit = CopyLimit(src.lowTwistLimit);
            conf.angularYLimit = CopyLimit(src.swing1Limit);
            conf.angularZLimit = CopyLimit(src.swing2Limit);

            conf.angularXLimitSpring = CopyLimitSpring(src.twistLimitSpring);
            conf.angularYZLimitSpring = CopyLimitSpring(src.swingLimitSpring);

            conf.enableCollision = src.enableCollision;

            conf.projectionMode = src.enableProjection? JointProjectionMode.PositionAndRotation: JointProjectionMode.None;
            conf.projectionAngle = src.projectionAngle;
            conf.projectionDistance = src.projectionDistance;

            #if UNITY_EDITOR
            UnityEditor.Undo.DestroyObjectImmediate(src);
            #else
            GameObject.DestroyImmediate(src);
            #endif
        }
コード例 #18
0
        public static void ApplyDeltaToJointLimit(ref CharacterJoint joint, float delta, JointAxis jointAxis)
        {
            switch(jointAxis) {
            case JointAxis.Primary:
                SoftJointLimit lowX = joint.lowTwistLimit;
                lowX.limit += delta;
                joint.lowTwistLimit = lowX;

                SoftJointLimit highX = joint.highTwistLimit;
                highX.limit += delta;
                joint.highTwistLimit = highX;
                break;
            case JointAxis.Secondary:
                SoftJointLimit y = joint.swing1Limit;
                y.limit += delta;
                joint.swing1Limit = y;
                break;
            case JointAxis.Tertiary:
                SoftJointLimit z = joint.swing2Limit;
                z.limit += delta;
                joint.swing2Limit = z;
                break;
            }
        }
コード例 #19
0
ファイル: Link.cs プロジェクト: timKofoed/MatchShooter
        public void RemoveJoint()
        {
            if (joint == null)
                return;

            if (Application.isPlaying)
                GameObject.Destroy(joint);
            else
                GameObject.DestroyImmediate(joint);

            joint = null;
        }
コード例 #20
0
 public static Quaternion JointToLocalSpace(CharacterJoint joint)
 {
     return Quaternion.Inverse(LocalToJointSpace(joint));
 }
コード例 #21
0
 public static JointAxis GetJointAxis(CharacterJoint joint, Vector3 vLocal)
 {
     return GetJointAxis(joint.axis, joint.swingAxis, vLocal);
 }
コード例 #22
0
 /// <summary>
 /// The generated code checks will only create a character joint if there is no existing one. A public member variable
 /// is generated for every dynamically created character joint. Further on a reference to it is added to allCharacterJoints.
 /// </summary>
 private static void CreateCharacterJointMethod(GameObject gameObject, CharacterJoint joint, string name, string path)
 {
     string code = Line (1, "internal virtual CharacterJoint CreateCharacterJoint_" + name + "(GameObject gameObject, string name, string path) {");
     code += Code (2, "Transform childTransform = gameObject.transform.FindChild (path)");
     code += Code (2, "GameObject childGameObject = childTransform.gameObject");
     code += Code (2, "CharacterJoint joint = childGameObject.GetComponent <CharacterJoint> ()");
     code += Line (2, "if (joint == null) {");
     code += Code (3, "joint = childGameObject.AddComponent <CharacterJoint> ()");
     code += Line (2, "}");
     string publicMemberVar = name + "_CharacterJoint";
     publicMemberVar = AddPublicMember ("CharacterJoint", publicMemberVar);
     code += Code (2, publicMemberVar + "= joint");
     code += Code (2, "joint.breakForce = " + MakeFloat (joint.breakForce));
     code += Code (2, "joint.breakTorque = " + MakeFloat (joint.breakTorque));
     code += Code (2, "joint.anchor = " + SetVector (joint.anchor));
     code += Code (2, "joint.axis = " + SetVector (joint.axis));
     code += Code (2, "joint.swingAxis = " + SetVector (joint.swingAxis));
     code += SetSoftJointLimit (2, "joint", "lowTwistLimit", joint.lowTwistLimit);
     code += SetSoftJointLimit (2, "joint", "highTwistLimit", joint.highTwistLimit);
     code += SetSoftJointLimit (2, "joint", "swing1Limit", joint.swing1Limit);
     code += SetSoftJointLimit (2, "joint", "swing2Limit", joint.swing2Limit);
     code += Code (2, " Transform parentTransform = gameObject.transform.FindChild (\"" + GetPath (joint.connectedBody.transform) + "\")");
     code += Line (2, "if (parentTransform == null) {");
     code += Code (3, "Debug.LogWarning (\"parentGameObject for \" + childGameObject.name + \" not found! Maybe initalisation is not yet done.\")");
     code += Code (3, "joint.connectedBody = null");
     code += Line (2, "} else {");
     code += Code (3, "joint.connectedBody = parentTransform.gameObject.rigidbody");
     code += Line (2, "}");
     code += Code (2, "allCharacterJoints.Add (joint)");
     code += Code (2, "return joint");
     code += Line (1, "}", 2);
     AddMethodCode (code);
     string call = "CreateCharacterJoint_" + name + "(gameObject, \"" + name + "\", \"" + path + "\")";
     AddMethodCallFromMain (call);
 }
コード例 #23
0
    //TODO are we locking cursor on start?
    void Awake()
    {

        _targetRigidBody = TargetIndicator.GetComponent<Rigidbody>();
        _targetJoint = TargetIndicator.GetComponent<CharacterJoint>();
    }
コード例 #24
0
        public static void SwitchXY(ref CharacterJoint joint)
        {
            Undo.RecordObject(joint, "Switch Yellow/Green Joint Axis");

            Vector3 axis = joint.axis;
            joint.axis = joint.swingAxis;
            joint.swingAxis = axis;
        }
コード例 #25
0
 static public int get_targetRotation(IntPtr l)
 {
     UnityEngine.CharacterJoint o = (UnityEngine.CharacterJoint)checkSelf(l);
     pushValue(l, o.targetRotation);
     return(1);
 }
コード例 #26
0
ファイル: Link.cs プロジェクト: timKofoed/MatchShooter
        public void ApplyJointSettings(float _anchorOffset)
        {

#if UNITY_4_3 || UNITY_4_5 || UNITY_4_6
            RemoveJoint();
            joint = gameObject.AddComponent<CharacterJoint>();
#else
            if (joint == null)
            {
                joint = gameObject.GetComponent<CharacterJoint>();
                if (joint == null)
                    joint = gameObject.AddComponent<CharacterJoint>();
            }
#endif

            joint.anchor = new Vector3(0, _anchorOffset, 0);
            joint.autoConfigureConnectedAnchor = true;
            //joint.connectedAnchor = new Vector3(0, 0, 0);

            joint.axis = Vector3.up;
            joint.swingAxis = Vector3.right;

            joint.lowTwistLimit = new SoftJointLimit() { limit = -jointSettings.twistLimit };
            joint.highTwistLimit = new SoftJointLimit() { limit = jointSettings.twistLimit };

            joint.swing1Limit = new SoftJointLimit() { limit = jointSettings.swingLimit };
            joint.swing2Limit = new SoftJointLimit() { limit = jointSettings.swingLimit };
            
            joint.breakForce = jointSettings.breakForce;
            joint.breakTorque = jointSettings.breakTorque;
        }
コード例 #27
0
        public static void SwitchYZ(ref CharacterJoint joint)
        {
            Undo.RecordObject(joint, "Switch Green/Blue Joint Axis");

            Vector3 cross = Vector3.Cross(joint.axis, joint.swingAxis).normalized;
            joint.swingAxis = cross;
        }
コード例 #28
0
ファイル: CompHelper.cs プロジェクト: exdev/urban-survivors
    // ------------------------------------------------------------------ 
    // Desc: 
    // ------------------------------------------------------------------ 

    static bool CopyCharacterJoint ( CharacterJoint _src, CharacterJoint _dest ) {
        // get src and dest root
        Transform src_root = _src.transform;
        while ( src_root.parent != null ) {
            src_root = src_root.parent;
        }
        Transform dest_root = _dest.transform;
        while ( dest_root.parent != null ) {
            dest_root = dest_root.parent;
        }

        //
        if ( _src.connectedBody != null ) {
            if ( _src.connectedBody.transform.IsChildOf(src_root) )
            {
                string path = "";
                Transform trans = _src.connectedBody.transform;
                while(trans.rigidbody != src_root.rigidbody) {
                    if ( path == "" ) path = trans.name;
                    else path = trans.name + "/" + path;
                    trans = trans.parent;
                }
                Transform relativeTrans = dest_root.Find(path);
                if (relativeTrans)
                    _dest.connectedBody = relativeTrans.rigidbody;
                else if (_src.connectedBody == src_root.rigidbody) {
                    _dest.connectedBody = dest_root.rigidbody;
                }
                else{
                    _dest.connectedBody=_src.connectedBody;
                }
            }
            else
                _dest.connectedBody=_src.connectedBody;
        }
        else
            _dest.connectedBody=_src.connectedBody;

        _dest.anchor=_src.anchor;
        _dest.axis=_src.axis;
        _dest.swingAxis=_src.swingAxis;
        _dest.lowTwistLimit=_src.lowTwistLimit;
        _dest.highTwistLimit=_src.highTwistLimit;
        _dest.swing1Limit=_src.swing1Limit;
        _dest.swing2Limit=_src.swing2Limit;
        _dest.breakForce=_src.breakForce;
        _dest.breakTorque=_src.breakTorque;
        return true;
    }
コード例 #29
0
 static public int get_targetAngularVelocity(IntPtr l)
 {
     UnityEngine.CharacterJoint o = (UnityEngine.CharacterJoint)checkSelf(l);
     pushValue(l, o.targetAngularVelocity);
     return(1);
 }
コード例 #30
0
 public static Vector3 JointAxisToVector3(CharacterJoint joint, JointAxis jointAxis)
 {
     return JointAxisToVector3(joint.axis, joint.swingAxis, jointAxis);
 }
コード例 #31
0
 public static JointAxis GetSymmetricJointAxis(CharacterJoint joint, JointAxis jointAxis, CharacterJoint symmetricJoint, Transform root)
 {
     return GetSymmetricJointAxis(joint.transform, joint.axis, joint.swingAxis, jointAxis, symmetricJoint.transform, symmetricJoint.axis, symmetricJoint.swingAxis, root);
 }
コード例 #32
0
ファイル: PushAbility.cs プロジェクト: ForsakenGS/LostKids
    void GrabObject(GameObject go, Vector3 origin, Vector3 target) {
        targetGameObject = go;
        targetGameObject.transform.position += Vector3.up * 0.05f;
        joint = gameObject.AddComponent<CharacterJoint>();

        Rigidbody targetRigidBody = targetGameObject.GetComponent<Rigidbody>();

        joint.autoConfigureConnectedAnchor = true;
        //Al final todo esto ha sio pa mierda porque ha funcionado el autoconfigure
        //No seran necesarios los parametros de la funcion, pero hasta que se confirme que es estable se mantiene

        //origin= this.transform.position + Vector3.up * altura;
        //origin.z += GetComponent<CapsuleCollider>().radius;
        //origin.y = +0.3f;
        //target.y=0.35f;
        //joint.anchor = origin; //Probablemente no sea necesario cuando se improten bien los modelos
        joint.breakForce = float.MaxValue;
        joint.connectedBody = targetRigidBody;

        //joint.connectedAnchor = target;

        targetGameObject.GetComponent<PushableObject>().Grab(this);

    }
コード例 #33
0
 internal virtual CharacterJoint CreateCharacterJoint_UpperArm_R(GameObject gameObject, string name, string path)
 {
     Transform childTransform = gameObject.transform.FindChild (path);
     GameObject childGameObject = childTransform.gameObject;
     CharacterJoint joint = childGameObject.GetComponent <CharacterJoint> ();
     if (joint != null) {
         Debug.LogWarning ("Existing joint " + joint.name + " found");
         return null;
     }
     joint = childGameObject.AddComponent <CharacterJoint> ();
     upperArm_R_CharacterJoint= joint;
     joint.breakForce = Mathf.Infinity;
     joint.breakTorque = Mathf.Infinity;
     joint.anchor = new Vector3 (0f, 0f, 0f);
     joint.axis = new Vector3 (0f, -1f, 0f);
     joint.swingAxis = new Vector3 (0f, 0f, -1f);
     SoftJointLimit lowTwistLimitNew = joint.lowTwistLimit;
     lowTwistLimitNew.limit = -70f;
     lowTwistLimitNew.spring = 0f;
     lowTwistLimitNew.damper = 0f;
     lowTwistLimitNew.bounciness = 0f;
     joint.lowTwistLimit = lowTwistLimitNew;
     SoftJointLimit highTwistLimitNew = joint.highTwistLimit;
     highTwistLimitNew.limit = 10f;
     highTwistLimitNew.spring = 0f;
     highTwistLimitNew.damper = 0f;
     highTwistLimitNew.bounciness = 0f;
     joint.highTwistLimit = highTwistLimitNew;
     SoftJointLimit swing1LimitNew = joint.swing1Limit;
     swing1LimitNew.limit = 50f;
     swing1LimitNew.spring = 0f;
     swing1LimitNew.damper = 0f;
     swing1LimitNew.bounciness = 0f;
     joint.swing1Limit = swing1LimitNew;
     SoftJointLimit swing2LimitNew = joint.swing2Limit;
     swing2LimitNew.limit = 0f;
     swing2LimitNew.spring = 0f;
     swing2LimitNew.damper = 0f;
     swing2LimitNew.bounciness = 0f;
     joint.swing2Limit = swing2LimitNew;
      Transform parentTransform = gameObject.transform.FindChild ("Armature/Hips/Spine/Ribs");
     if (parentTransform == null) {
         Debug.LogWarning ("parentGameObject for " + childGameObject.name + " not found! Maybe initalisation is not yet done.");
         joint.connectedBody = null;
     } else {
         joint.connectedBody = parentTransform.gameObject.rigidbody;
     }
     allCharacterJoints.Add (joint);
     return joint;
 }
コード例 #34
0
        public static Quaternion LocalToJointSpace(CharacterJoint joint)
        {
            Vector3 forward = Vector3.Cross (joint.axis, joint.swingAxis).normalized;
            Vector3 up = Vector3.Cross(forward, joint.axis).normalized;

            if (forward == up) {
                Debug.LogWarning("Joint " + joint.name + " swingAxis is in the exact same direction as it's axis. Please make sure they are not aligned.");
            }

            return Quaternion.LookRotation(forward, up);
        }