FarseerPhysics.Dynamics.Contacts.Contact.getWorldManifold C# (CSharp) Method

getWorldManifold() public method

Gets the world manifold.
public getWorldManifold ( System.Vector2 &normal, FixedArray2 &points ) : void
normal System.Vector2
points FixedArray2
return void
		public void getWorldManifold( out Vector2 normal, out FixedArray2<Vector2> points )
		{
			var bodyA = fixtureA.body;
			var bodyB = fixtureB.body;
			var shapeA = fixtureA.shape;
			var shapeB = fixtureB.shape;

			ContactSolver.WorldManifold.initialize( ref manifold, ref bodyA._xf, shapeA.radius, ref bodyB._xf, shapeB.radius, out normal, out points );
		}

Usage Example

コード例 #1
0
ファイル: FSDebugView.cs プロジェクト: prime31/Nez
		void preSolve( Contact contact, ref Manifold oldManifold )
		{
			if( ( flags & DebugViewFlags.ContactPoints ) == DebugViewFlags.ContactPoints )
			{
				Manifold manifold = contact.manifold;

				if( manifold.pointCount == 0 )
					return;

				Fixture fixtureA = contact.fixtureA;

				FixedArray2<PointState> state1, state2;
				FarseerPhysics.Collision.Collision.getPointStates( out state1, out state2, ref oldManifold, ref manifold );

				FixedArray2<Vector2> points;
				Vector2 normal;
				contact.getWorldManifold( out normal, out points );

				for( int i = 0; i < manifold.pointCount && _pointCount < maxContactPoints; ++i )
				{
					if( fixtureA == null )
						_points[i] = new ContactPoint();

					ContactPoint cp = _points[_pointCount];
					cp.position = points[i];
					cp.normal = normal;
					cp.state = state2[i];
					_points[_pointCount] = cp;
					++_pointCount;
				}
			}
		}