Example #1
0
 protected virtual void OnUserBilateral(CUserBilateralEventArgs pEventArgs)
 {
     if (m_UserBilateral != null)
     {
         m_UserBilateral(this, pEventArgs);
     }
 }
Example #2
0
        private void joint_Callback(object sender, CUserBilateralEventArgs e)
        {
            if (!IsEnabled)
            {
                return;
            }

            foreach (UserJointConstraint constraint in _constraints)
            {
                constraint.ApplyConstraint(this);
            }

            CJointUserDefinedBilateral handle = this.NewtonJoint;
            double maxForce = 0;

            // break any constraints
            for (int i = 0; i < _constraints.Count; i++)
            {
                _constraints[i].UpdateForce(this, i);
                double force = _constraints[i].Force;

                if (force > maxForce)
                {
                    maxForce = force;
                }

                if ((_constraints[i].MaxForce > 0) &&
                    (force > _constraints[i].MaxForce))
                {
                    OnBroke();
                    return;
                }
            }

            double max = this.MaxForce;

            if ((max > 0) && (maxForce > max))
            {
                OnBroke();
            }
        }
		protected virtual void OnUserBilateral(CUserBilateralEventArgs pEventArgs)
		{
			if (m_UserBilateral != null)
			{
				m_UserBilateral(this, pEventArgs);
			}
		}
		private void joint_Callback(object sender, CUserBilateralEventArgs e)
        {
            if (!IsEnabled)
                return;

            foreach (UserJointConstraint constraint in _constraints)
            {
                constraint.ApplyConstraint(this);
            }

            CJointUserDefinedBilateral handle = this.NewtonJoint;
            double maxForce = 0;
            // break any constraints
            for(int i = 0; i < _constraints.Count; i++)
            {
                _constraints[i].UpdateForce(this, i);
                double force = _constraints[i].Force;

                if (force > maxForce)
                    maxForce = force;

                if ((_constraints[i].MaxForce > 0) &&
                    (force > _constraints[i].MaxForce))
                {
                    OnBroke();
                    return;
                }
            }

            double max = this.MaxForce;
            if ((max > 0) && (maxForce > max))
            {
                OnBroke();
            }
        }