-1

Ubuntu 14.04 Python with pybox2d

I want to write an agent program who can response to the motion of bodies in running testbed. As my target, it's natural that the agent should read the body's state data from some where. Then take some response to the data according to the code. But pybox2d is based on box2d which is in C++ I am not familiar. So who can give me the advice. Thanks!

Or, you can recommend me another property plan.

hotgarlic
  • 1
  • 2

1 Answers1

0

Sounds like what you'd like is a way to select a body in a Testbed test, and get textual output on its state. There's no straight-forward way to get this sort of additional information about a body however (not in the Box2D 2.3.3 or earlier Testbed program).

I do like this idea as an enhancement of the Testbed. I don't think that would be too hard for me to do at least in my Box2D fork. I've created an issue for this.

In the meantime (until such a feature made it into a build of the Testbed that you had), you could run the Testbed through a debugger and use breakpoints to get this information. It'd be complicated however by having to figure out which data structure related to which body and by having to figure out when to get the break point to trigger.

OTOH, if what you're asking for is a programmatic way of getting body state, at least in the C++ version of Box2D there's methods you can call on the b2Body object for this. GetLinearVelocity() for example will get the linear velocity of the body. I suspect pybox2d has a similarly named accessor mechanism.

Louis Langholtz
  • 2,913
  • 3
  • 17
  • 40
  • Thanks Louis. I found a better solution on this site http://www.danielslater.net/2015/12/how-to-run-learning-agents-against.html?m=1. Of course it is my cake. So easy to apply, as make some screen shot. And it works I tried. Hope it is helpful to others. – hotgarlic Mar 15 '17 at 23:07