Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

How can I get the current state of a body in Box2d

$
0
0

I am trying to create a wraparound on a box2d sketch so that if a body moves to a certain point on the screen eg on the left, it gets moved to the right. To do this I am killing the body on the right with the intention of creating the body on the left. However, simply calling makebody with the same y position doesn't work because the physics are re-initialised at their starting values, so when it gets made on the right it looks as if the body has actually sped up (ie the cumulative effect of friction etc on the velocity is not copied over). So is there a way of copying a body's state? I imagine this is mainly the current velocity at the time the body is killed because the fixture values are all constant.


Viewing all articles
Browse latest Browse all 2896

Trending Articles