Exemple #1
0
    public float GetPosition()
    {
        float position = 0.0f;

        if (m_joint != null)
        {
            dNewtonJointSliderActuator joint = (dNewtonJointSliderActuator)m_joint;
            position = joint.GetPosition();
        }
        return(position);
    }
    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 dNewtonJointSliderActuator(matrix, child.GetBody().GetBody(), otherBody);

        Speed          = m_speed;
        MaxForce       = m_maxForce;
        TargetPosition = m_targetPosition;
    }
        public override void InitJoint()
        {
            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 dNewtonJointSliderActuator(matrix, child.GetBody().GetBody(), otherBody);

            EnableCollision = m_EnableCollision;
            Speed           = m_Speed;
            MaxForce        = m_MaxForce;
            TargetPosition  = m_TargetPosition;
        }