Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Strange simulation when combining Box2D with SFML


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 Fs02   Members   -  Reputation: 429

Like
0Likes
Like

Posted 04 February 2013 - 12:28 PM

I want to make a game using Box2D v 2.2.1 and SFML 2, but i have a little problem with the physic simulation, its act strangely and different from when tested using default testbed.
 
I try to simulate the tire from behavior iforce.net tutorial that working well on the default testbed. 
 
my main code:

...
void GAME::GameLoading()
{
    testTire = new Tire(&_mainWorld);
    _gameState = gs_Playing;
}

void GAME::MainLoop()
{
    ...
    while (_mainWindow.isOpen())
    {
        switch (_gameState)
        {

            case gs_Loading:
            {
                GameLoading();
                break;
            }
            case gs_Playing:
            {
                _mainWindow.clear();
		_mainWorld.Step(1/60.f,6,2);
                testTire->updateFriction();
                DebugRender();
                _mainWindow.display();
                break;
            }
        }
	...
    }
}
...
b2Vec2 Gravity(10.f,0.f); //Make the tire move
b2World GAME::_mainWorld(Gravity);
Tire* GAME::testTire;
 

when i run this, the tire just move in x(gravity) axis with slow movement because the friction i made, but it wont move in y axis, i've try to rotate it a few degrees to but it doing the same.

 

please help me fix the code, i have worked on it for five days and still didn't find any solution.

 

Thaks smile.png

 

PS : Sorry for my bad english


Edited by Fs02, 04 February 2013 - 01:09 PM.

[my game in #ggj14 : http://www.indiedb.com/games/romance-stalker [my blog : http://surya.volge.net ]


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS