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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - nyaa

Pages: [1]
1
General / Re: Box2D + SFML question
« on: December 22, 2013, 01:40:31 pm »
Unless I am mistaken...

world.Step(60.0f, 8, 3);

You need to measure the elapsed time for each frame and pass it to your world. Passing 60 seconds when maybe only 1/60th of a second has passed is totally wrong.  ;)

Ah of course. Thanks for noticing this. I really meant to type "1.0f / 60.0f" instead of just "60.0f". (And I will introduce variable time step later on.)

Anyway, I seem to have figured out the problem. It seems that in Box2D a body's origin is the center of the said body, while in SFML the origin is top left corner. Setting the origin of SFML shape to center of the shape seems to fix the gap problem. ;D

2
General / Box2D + SFML question
« on: December 22, 2013, 01:18:45 pm »
I'm trying to integrate Box2D into my little playground project. But I can't seem to figure out how to fix this bug:

http://i.imgur.com/iKdEa3W.png

I seem to be doing everything correctly, but why is there a gap between my static and dynamic body?

Here's my code.

No need to fix my horrible code, just point me in the right direction. ;)

Pages: [1]