2.0 Feedback Request for Advanced Users

2.0 is starting to firm up. I would like all advanced/experienced users to start reviewing the API and providing feedback in this thread.

I will soon start updating the manual for 2.0 and I would rather not change the API once that has begun.

I will soon include the doxygen docs to help you out.

Please try to restrict the discussion to API structure, and not about new features (unless it seems I forgot something important). In particular, I am seeking ideas about simplifying joint creation, which has become more complex.

Silence will be viewed as acceptance. 🙂
Wow, 2.0 was surprisingly easy to compile using VS2005, and I haven't touched C++ since ~2 years ago. Since then I have used: COBOL, ESA/390 assembler, HTML, CSS, Ruby, PHP, JavaScript, and AS3... so luckily I was able to just push buttons and it worked! I'm very excited about 2.0 now and if I wasn't trying to finish a game I would be porting to AS3 right now, bugs and all!

I am liking the API so far, but will have to take a closer look at joints. I have only worked with revolute joints so far in 1.4.3. Just wanted to drop in and say I am doing my homework 😀
That looks an awful lot like MY car example 😛 Except it doesn't seem to explode now, which is awesome 😀 But no shocks 🙁 Anyway, I'm taking a short break from Box2D (school and work are demanding attention)... just wanted to say it's looking good 🙂 Thanks again for all your hard work Erin.
I have some things I want to post in here...but we have a deadline coming up on Friday and we are a shade behind...so I haven't had time to fully collect my thoughts yet.
@Erin:

I have been looking at the MotorsAndLimits example and I see what you mean about joint creation getting more complicated. It seems like there should just be a method to set the anchor point for a revolute joint, which would set the two internal anchor points, getting local coordinates on each body automatically. Unless there is some reason why you'd want to set them to something different, but I thought they didn't work like that.

I think I know what the reference angle is, and it worked this way in the last version correct? Only it was done internally. I remember being confused trying to set limits that I assumed were in absolute coordinates, and not being able to get things how I wanted them until I tried setting the same limits for 2 different revolute joints (which had different relative rotations) and it magically worked! It's a great thing to have, and would be nice if it defaulted to this behavior without setting it, but you could set it to whatever absolute rotation you wanted too.

I personally really liked the system of just setting things like anchor points in terms of world coordinates. That's what I imagine people will want to do most of the time. You can just get the center point for a body and use that, or get the mouse coordinate, or a contact point. Very intuitive, and I think having to call GetLocalPoint() every time is a bit redundant.

I am still looking at things, and have run a local Doxygen which is helping quite a bit. If you have any specific things that you are wondering if should be done method A or method B that would be helpful too. I have been working with Box2D a lot, but I haven't used every part of it, and I am just beginning to explore 2.0, so I am not aware of all the additions/changes.
The reason for the local points and reference angle is so that you can define a joint in a save/load situation. When you load the bodies from their saved state, the joint anchor may have some misalignment. So using a world point for the anchor would add some error.

I will write some utility functions to compute the anchors, etc, from world data.

The other big API change is how shapes are created and destroyed.

Fortunately continuous physics had little impact on the API.
Erin Catto wrote:
...The other big API change is how shapes are created and destroyed...


So I gotta say that I am really enjoying the fact that I can add a delete shapes on the fly, its pretty sweet. However, I updated once when you had CreateBody, CreateJoint, and AddShape, or something to those effects. And I was pretty pleased about that, as the function name described what it was going to do. But now with everything just being Create its a little less clear, I can figure out whats going on but its less clear. I think the worst 'Create' function is b2Body::Create(), just isn't clear that thats going to add the shape def to the body. At first glance I thought it was a factory for the body.
allanon: Understandable. I'll make the method names more specific.
I changed the factory names.

Also, I checked in the Doxygen API docs.

I'll work on the joint definitions and manual next.
Very minor detail in the b2World.h
probably the last thing i would fix 🙂
/// Get the world shape list. These shapes may or may not be attached to bodies.
/// With the returned shape, use b2Shape::GetWorldNext to get the next shape in
/// the world list. A NULL shape indicates the end of the list.
/// @return the head of the world shape list.
b2Shape* GetShapeList();

/// Get the world shape list. These shapes may or may not be attached to bodies.
/// With the returned shape, use b2Shape::GetWorldNext to get the next shape in
/// the world list. A NULL shape indicates the end of the list.
/// @return the head of the world shape list.
b2Body* GetBodyList();

/// Get the world shape list. These shapes may or may not be attached to bodies.
/// With the returned shape, use b2Shape::GetWorldNext to get the next shape in
/// the world list. A NULL shape indicates the end of the list.
/// @return the head of the world shape list.
b2Joint* GetJointList();

/// Get the world shape list. These shapes may or may not be attached to bodies.
/// With the returned shape, use b2Shape::GetWorldNext to get the next shape in
/// the world list. A NULL shape indicates the end of the list.
/// @return the head of the world shape list.
b2Contact* GetContactList();

Mike

Original thread: https://box2d.org/forum/viewtopic.php?t=370