Esempio n. 1
0
        protected float SolveCombinedContactFriction(RigidBody bodyA, RigidBody bodyB, ManifoldPoint cp, ContactSolverInfo info, int iter, IDebugDraw debugDraw)
        {
            float maxImpulse = 0;

            Vector3 color = new Vector3(0, 1, 0);

            if (cp.Distance <= 0)
            {
                if (iter == 0)
                {
                    if (debugDraw != null)
                    {
                        debugDraw.DrawContactPoint(cp.PositionWorldOnB, cp.NormalWorldOnB, cp.Distance, cp.LifeTime, color);
                    }
                }

                float impulse = ContactConstraint.ResolveSingleCollisionCombined(
                    bodyA, bodyB,
                    cp,
                    info);

                if (maxImpulse < impulse)
                {
                    maxImpulse = impulse;
                }
            }
            return(maxImpulse);
        }
Esempio n. 2
0
        protected float Solve(RigidBody bodyA, RigidBody bodyB, ManifoldPoint cp, ContactSolverInfo info, int iter, IDebugDraw debugDraw)
        {
            float maxImpulse = 0;

            Vector3 color = new Vector3(0, 1, 0);

            if (cp.Distance <= 0)
            {
                if (iter == 0)
                {
                    if (debugDraw != null)
                    {
                        debugDraw.DrawContactPoint(cp.PositionWorldOnB, cp.NormalWorldOnB, cp.Distance, cp.LifeTime, color);
                    }
                }

                ConstraintPersistentData cpd = cp.UserPersistentData as ConstraintPersistentData;
                float impulse = cpd.ContactSolverFunc(
                    bodyA, bodyB,
                    cp,
                    info);

                if (maxImpulse < impulse)
                {
                    maxImpulse = impulse;
                }
            }
            return(maxImpulse);
        }
Esempio n. 3
0
 public void DebugDraw(IDebugDraw debugDrawer)
 {
     if (_stepping)
     {
         var b     = new Vector3(0, 0, 1);
         var color = new Vector3(0, 0.3f, 1);
         debugDrawer.DrawContactPoint(ref _steppingTo, ref b, 0, 1000,
                                      ref color);
     }
 }
		protected float Solve(RigidBody bodyA, RigidBody bodyB, ManifoldPoint cp, ContactSolverInfo info, int iter, IDebugDraw debugDraw)
		{
			float maxImpulse = 0;

			Vector3 color = new Vector3(0, 1, 0);
			if (cp.Distance <= 0)
			{
				if (iter == 0)
					if(debugDraw != null)
						debugDraw.DrawContactPoint(cp.PositionWorldOnB, cp.NormalWorldOnB, cp.Distance, cp.LifeTime, color);

				ConstraintPersistentData cpd = cp.UserPersistentData as ConstraintPersistentData;
				float impulse = cpd.ContactSolverFunc(
					bodyA, bodyB,
					cp,
					info);

				if (maxImpulse < impulse)
					maxImpulse = impulse;
			}
			return maxImpulse;
		}
		protected float SolveCombinedContactFriction(RigidBody bodyA, RigidBody bodyB, ManifoldPoint cp, ContactSolverInfo info, int iter, IDebugDraw debugDraw)
		{
			float maxImpulse = 0;

			Vector3 color = new Vector3(0, 1, 0);
			if (cp.Distance <= 0)
			{
				if (iter == 0)
					if (debugDraw != null)
						debugDraw.DrawContactPoint(cp.PositionWorldOnB, cp.NormalWorldOnB, cp.Distance, cp.LifeTime, color);

				float impulse = ContactConstraint.ResolveSingleCollisionCombined(
					bodyA, bodyB,
					cp,
					info);

				if (maxImpulse < impulse)
					maxImpulse = impulse;
			}
			return maxImpulse;
		}