Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: box2d  (Read 7543 times)

0 Members and 1 Guest are viewing this topic.

TheVirtualDragon

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Control + Alt + Delete!
Re: box2d
« Reply #15 on: August 22, 2012, 09:25:57 am »
Sorry about that. I automatically presumed you flipped the y axis in sfml so dont listen to me about that. (That was probably because I am addicted to realistic physics... :-X)

Kubik

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • Email
Re: box2d
« Reply #16 on: August 22, 2012, 11:00:22 am »
So how much pixels in meter?

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: box2d
« Reply #17 on: August 22, 2012, 11:12:37 am »
That's your choice to make. Depends on the game/billion other things. Just try to follow everything recommended in box2d user manual.
Back to C++ gamedev with SFML in May 2023

Kubik

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • Email
Re: box2d
« Reply #18 on: August 22, 2012, 11:17:04 am »
Thanks :)

TheVirtualDragon

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Control + Alt + Delete!
Re: box2d
« Reply #19 on: August 22, 2012, 11:18:29 am »
You have to define the metre your self : there is no definition which I am aware of...

For example, if you have a sprite of a ten year old which is 64x64 pixels, then you can say that 1 metre is 50 pixels. This will mean that your sprite is 1.28m tall.
To implement this, you have to scale your box2d measurements up by 50 and your sfml measurements down by 50. Alternatively, you could set up a view, like this:

sf::View gameView ( sf::FloatRect (0, 0, 800 / 50, 600 / 50) );
 

Hope that helped.

 

anything