Ejemplo n.º 1
0
        public override void InitJoint()
        {
            Vector3 childPin  = m_Pin.normalized;
            Vector3 parentPin = m_ParentPin.normalized;

            NewtonBody child     = GetComponent <NewtonBody>();
            IntPtr     otherBody = (m_OtherBody != null) ? m_OtherBody.GetBody().GetBody() : IntPtr.Zero;

            dVector childPin_  = new dVector(childPin.x, childPin.y, childPin.z, 0.0f);
            dVector parentPin_ = new dVector(parentPin.x, parentPin.y, parentPin.z, 0.0f);

            m_Joint = new dNewtonJointGear(m_GearRatio, childPin_, parentPin_, child.GetBody().GetBody(), otherBody);

            EnableCollision = m_EnableCollision;
        }
Ejemplo n.º 2
0
    public override void Create()
    {
        Matrix4x4 localMatrix0 = Matrix4x4.identity;
        Matrix4x4 localMatrix1 = Matrix4x4.identity;

        localMatrix0.SetTRS(Vector3.zero, Quaternion.Euler(m_rotation), Vector3.one);
        localMatrix1.SetTRS(Vector3.zero, Quaternion.Euler(m_parentRotation), Vector3.one);

        Vector4 childPin  = localMatrix0.GetColumn(0);
        Vector4 parentPin = localMatrix1.GetColumn(0);

        NewtonBody child     = GetComponent <NewtonBody>();
        IntPtr     otherBody = (m_otherBody != null) ? m_otherBody.GetBody().GetBody() : new IntPtr(0);

        dVector childPin_  = new dVector(childPin.x, childPin.y, childPin.z, 0.0f);
        dVector parentPin_ = new dVector(parentPin.x, parentPin.y, parentPin.z, 0.0f);

        m_joint = new dNewtonJointGear(m_gearRatio, childPin_, parentPin_, child.GetBody().GetBody(), otherBody);
    }