FarseerPhysics.Dynamics.Body.Body C# (CSharp) Method

Body() public method

public Body ( World world, Vector2 position = newVector2(), float rotation, BodyType bodyType = BodyType.Static, object userdata = null ) : System
world World
position Vector2
rotation float
bodyType BodyType
userdata object
return System
		public Body( World world, Vector2 position = new Vector2(), float rotation = 0, BodyType bodyType = BodyType.Static, object userdata = null )
		{
			fixtureList = new List<Fixture>();
			bodyId = _bodyIdCounter++;

			_world = world;
			_enabled = true;
			_awake = true;
			_sleepingAllowed = true;

			userData = userdata;
			gravityScale = 1.0f;
			this.bodyType = bodyType;

			_xf.q.Set( rotation );

			//FPE: optimization
			if( position != Vector2.Zero )
			{
				_xf.p = position;
				_sweep.C0 = _xf.p;
				_sweep.C = _xf.p;
			}

			//FPE: optimization
			if( rotation != 0 )
			{
				_sweep.A0 = rotation;
				_sweep.A = rotation;
			}

			world.addBody( this ); //FPE note: bodies can't live without a World
		}