예제 #1
0
    public override void Create()
    {
        NewtonBody child     = GetComponent <NewtonBody>();
        dMatrix    matrix    = Utils.ToMatrix(m_posit, Quaternion.Euler(m_rotation));
        IntPtr     otherBody = (m_otherBody != null) ? m_otherBody.GetBody().GetBody() : new IntPtr(0);

        m_joint = new dNewtonJointHinge(matrix, child.GetBody().GetBody(), otherBody);

        Stiffness       = m_stiffness;
        EnableLimits    = m_enableLimits;
        SetSpringDamper = m_setSpringDamper;
    }
        public override void InitJoint()
        {
            if (m_Initialized)
            {
                return;
            }

            NewtonBody child     = GetComponent <NewtonBody>();
            dMatrix    matrix    = Utils.ToMatrix(m_Pivot, m_Pin);
            IntPtr     otherBody = (m_OtherBody != null) ? m_OtherBody.GetBody().GetBody() : IntPtr.Zero;

            m_Joint = new dNewtonJointHinge(matrix, child.GetBody().GetBody(), otherBody);

            Stiffness       = m_Stiffness;
            EnableCollision = m_EnableCollision;
            EnableLimits    = m_EnableLimits;
            SetSpringDamper = m_SetSpringDamper;
            m_Initialized   = true;
        }