コード例 #1
0
ファイル: Island.cs プロジェクト: CloneDeath/Box2D.Net
        public void Report(List <ContactVelocityConstraint> constraints)
        {
            if (m_listener == null)
            {
                return;
            }

            for (int i = 0; i < m_contacts.Count(); ++i)
            {
                Contact c = m_contacts[i];

                ContactVelocityConstraint vc = constraints[i];

                ContactImpulse impulse = new ContactImpulse();
                impulse.count = vc.points.Count();
                impulse.normalImpulses.Clear();
                impulse.tangentImpulses.Clear();
                for (int j = 0; j < vc.points.Count(); ++j)
                {
                    impulse.normalImpulses.Add(vc.points[j].normalImpulse);
                    impulse.tangentImpulses.Add(vc.points[j].tangentImpulse);
                }

                m_listener.PostSolve(c, impulse);
            }
        }
コード例 #2
0
ファイル: Breakable.cs プロジェクト: CloneDeath/Box2D.Net
		void PostSolve(Contact contact, ContactImpulse impulse)
		{
			if (m_broke)
			{
				// The body already broke.
				return;
			}

			// Should the body break?
			int count = contact.GetManifold().points.Count();

			float maxImpulse = 0.0f;
			for (int i = 0; i < count; ++i)
			{
				maxImpulse = Math.Max(maxImpulse, impulse.normalImpulses[i]);
			}

			if (maxImpulse > 40.0f)
			{
				// Flag the body for breaking.
				m_break = true;
			}
		}
コード例 #3
0
        public void Report(ContactConstraint[] constraints)
        {
            if (_listener == null)
            {
                return;
            }

            for (int i = 0; i < _contactCount; ++i)
            {
                Contact c = _contacts[i];

                ContactConstraint cc = constraints[i];

                ContactImpulse impulse = new ContactImpulse();
                for (int j = 0; j < cc.pointCount; ++j)
                {
                    impulse.normalImpulses[j]  = cc.points[j].normalImpulse;
                    impulse.tangentImpulses[j] = cc.points[j].tangentImpulse;
                }

                _listener.PostSolve(c, ref impulse);
            }
        }
コード例 #4
0
		/// This lets you inspect a contact after the solver is finished. This is useful
		/// for inspecting impulses.
		/// Note: the contact manifold does not include time of impact impulses, which can be
		/// arbitrarily large if the sub-step is small. Hence the impulse is provided explicitly
		/// in a separate data structure.
		/// Note: this is only called for contacts that are touching, solid, and awake.
		public virtual void PostSolve(Contact contact, ContactImpulse impulse)
		{
		}
コード例 #5
0
 /// This lets you inspect a contact after the solver is finished. This is useful
 /// for inspecting impulses.
 /// Note: the contact manifold does not include time of impact impulses, which can be
 /// arbitrarily large if the sub-step is small. Hence the impulse is provided explicitly
 /// in a separate data structure.
 /// Note: this is only called for contacts that are touching, solid, and awake.
 public virtual void PostSolve(Contact contact, ContactImpulse impulse)
 {
 }
コード例 #6
0
ファイル: Island.cs プロジェクト: CloneDeath/Box2D.Net
		public void Report(List<ContactVelocityConstraint> constraints) {
			if (m_listener == null) {
				return;
			}

			for (int i = 0; i < m_contacts.Count(); ++i) {
				Contact c = m_contacts[i];

				ContactVelocityConstraint vc = constraints[i];

				ContactImpulse impulse = new ContactImpulse();
				impulse.count = vc.points.Count();
				impulse.normalImpulses.Clear();
				impulse.tangentImpulses.Clear();
				for (int j = 0; j < vc.points.Count(); ++j) {
					impulse.normalImpulses.Add(vc.points[j].normalImpulse);
					impulse.tangentImpulses.Add(vc.points[j].tangentImpulse);
				}

				m_listener.PostSolve(c, impulse);
			}
		}
コード例 #7
0
 public void PostSolve(Contact contact, ref ContactImpulse impulse)
 {
 }