I'm trying to create mini black holes for my XNA game using farseer physics.
Problem is I can not get the gravity source to stick to the Body I've attached it to, as it scrolls across the screen, the gravity source simply stays in the same position. This is the code I've used.
Body blackHoleBody; blackHoleBody = BodyFactory.CreateBody(world); CircleShape ballShape = new CircleShape(ConvertUnits.ToSimUnits(imageItemList[i].texture.Width / 2f), 1f); Fixture ballFixture = blackHoleBody.CreateFixture(ballShape); blackHoleBody.BodyType = BodyType.Static; blackHoleBody.Position = ConvertUnits.ToSimUnits(imageItemList[i].Position); blackHoleBody.Restitution = 0.0f; blackHoleBody.CollisionCategories = Category.All; blackHoleBody.CollidesWith = Category.All; //Create the gravity controller GravityController gravity = new GravityController(10f); gravity.DisabledOnGroup = 3; gravity.EnabledOnGroup = 2; gravity.DisabledOnCategories = Category.Cat2; gravity.EnabledOnCategories = Category.Cat3; gravity.GravityType = GravityType.Linear; world.AddController(gravity); gravity.AddBody(blackHoleBody); ballBodyList.Add(blackHoleBody);
My guess is that I need to get in the GravityController inside world, and update it's position there, but when I look I can only find the world global gravity.
If anyone could point me in the right direction it would be much appreciated.