Nez.Farseer.FSRigidBody.createBody C# (CSharp) Method

createBody() public method

public createBody ( ) : void
return void
		void createBody()
		{
			if( body != null )
				return;
			
			var world = entity.scene.getOrCreateSceneComponent<FSWorld>();
			body = new Body( world, transform.position * FSConvert.displayToSim, transform.rotation, _bodyDef.bodyType, this );
			body.linearVelocity = _bodyDef.linearVelocity;
			body.angularVelocity = _bodyDef.angularVelocity;
			body.linearDamping = _bodyDef.linearDamping;
			body.angularDamping = _bodyDef.angularDamping;

			body.isBullet = _bodyDef.isBullet;
			body.isSleepingAllowed = _bodyDef.isSleepingAllowed;
			body.isAwake = _bodyDef.isAwake;
			body.enabled = enabled;
			body.fixedRotation = _bodyDef.fixedRotation;
			body.ignoreGravity = _bodyDef.ignoreGravity;
			body.mass = _bodyDef.mass;
			body.inertia = _bodyDef.inertia;

			var collisionShapes = entity.getComponents<FSCollisionShape>();
			for( var i = 0; i < collisionShapes.Count; i++ )
				collisionShapes[i].createFixture();
			ListPool<FSCollisionShape>.free( collisionShapes );

			for( var i = 0; i < _joints.Count; i++ )
				_joints[i].createJoint();
		}