Example #1
0
		public static Collider CreateBox(World world, Vector3 size)
		{
			return new Collider(NewtonCreateBox(world.Id, size.x, size.y, size.z, 0), world);
		}
Example #2
0
		public Body(World world, object owner, Matrix matrix, Collider collider)
		{
			this.collider = collider;
			this.world = world;
			id = NewtonCreateBody(world.Id, collider.Id);
			this.owner = owner;
			world.BodyCreated(id, this);

			setTransform = delegate(int bodyId)
			{
				Body body = world.GetBody(bodyId);
				if (body == null)
					return;

				if (body.OnMatrixChanged != null)
					body.OnMatrixChanged();
			};

			NewtonBodySetTransformCallback(id, setTransform);

			getForces = delegate(int bodyId)
			{
				Body body = world.GetBody(bodyId);
				if (body == null)
					return;

				if (body.OnGetForces != null)
					body.OnGetForces();
			};

			NewtonBodySetForceAndTorqueCallback(id, getForces);

			Matrix = matrix;
		}
Example #3
0
		Collider(int id, World world)
		{
			this.id = id;
			this.world = world;
		}