Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm currently trying to simply spawn a circle in Farseer. However, it's stuck wherever I spawn it! The game is updating fine, as I can see the circle spinning in place when I spawn it because of how I currently have gravity set up (following code from Game1.cs):

// Initialise the screen center for use with
// the Level class
screenCenter = new Vector2(graphics.GraphicsDevice.Viewport.Width / 2f, graphics.GraphicsDevice.Viewport.Height / 2f);

 world = new World(new Vector2(20, 20));
 currentLevel = new Level1(screenCenter, circleSprite, groundSprite, ref world);

Level1 constructor:

public Level1(Vector2 screenCenter, Texture2D circleSprite, Texture2D groundSprite, ref World world)
    {
        player = new Player(ref world, screenCenter, circleSprite);
        ground = new Ground(ref world, screenCenter, groundSprite);
        listLevelItems = new List<LevelItem>();
        listLevelItems.Add(player);
        listLevelItems.Add(ground);
    }

Player constructor:

public Player(ref World world, Vector2 screenCenter, Texture2D sprite)
    {
        setSprite(sprite);
        setPosition((screenCenter / MeterInPixels) + new Vector2(0f, 0f));

        playerBody = BodyFactory.CreateCircle(world, 96f / (2f * MeterInPixels), 1f, playerPosition);
        getBody().BodyType = BodyType.Dynamic;

        // Ball bounce and friction
        getBody().Restitution = 0.3f;
        getBody().Friction = 0.5f;
    }

If I use a breakpoint and change the playerBody position while the game is halted, the ball does move, but stays fixed in its new location.

Any help would be greatly appreciated.

share|improve this question
    
Are you adding mass to the circle somewhere? –  Byte56 Nov 27 '12 at 0:01
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.