FarseerPhysics.Dynamics.Body.createFixture C# (CSharp) Méthode

createFixture() public méthode

Creates a fixture and attach it to this body. If the density is non-zero, this function automatically updates the mass of the body. Contacts are not created until the next time step. Warning: This function is locked during callbacks.
public createFixture ( Shape shape, object userData = null ) : Fixture
shape FarseerPhysics.Collision.Shapes.Shape The shape.
userData object Application specific data
Résultat Fixture
		public Fixture createFixture( Shape shape, object userData = null )
		{
			return new Fixture( this, shape, userData );
		}

Usage Example

Exemple #1
0
		//Contributed by Matthew Bettcher

		/// <summary>
		/// Convert a path into a set of edges and attaches them to the specified body.
		/// Note: use only for static edges.
		/// </summary>
		/// <param name="path">The path.</param>
		/// <param name="body">The body.</param>
		/// <param name="subdivisions">The subdivisions.</param>
		public static void convertPathToEdges( Path path, Body body, int subdivisions )
		{
			var verts = path.getVertices( subdivisions );
			if( path.isClosed )
			{
				var chain = new ChainShape( verts, true );
				body.createFixture( chain );
			}
			else
			{
				for( int i = 1; i < verts.Count; i++ )
				{
					body.createFixture( new EdgeShape( verts[i], verts[i - 1] ) );
				}
			}
		}
All Usage Examples Of FarseerPhysics.Dynamics.Body::createFixture