behdad / box2d

Automatically exported from code.google.com/p/box2d
2 stars 12 forks source link

Feature Request: b2Body::ApplyForce to mass center #178

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Applying a force to a body's center of mass can be slower than expected, 
expecially in the case of composite shapes where mass center != origin.

Currently it is required to retrieve the center of mass, passing it to 
ApplyForce, that computes a b2cross which should be always 0.

Having an ApplyForce( const b2Vec2& force ) would be much cleaner and faster.

I added it, here's the patch. Hope this works.

Original issue reported on code.google.com by tommaso....@gmail.com on 23 Feb 2011 at 5:26

Attachments:

GoogleCodeExporter commented 9 years ago
This would be handy indeed.

Original comment by kiaranri...@gmail.com on 28 May 2011 at 8:29

GoogleCodeExporter commented 9 years ago
Rev 188

Don't expect this to improve performance. It is just syntactic sugar.

Original comment by erinca...@gmail.com on 26 Jun 2011 at 6:57

GoogleCodeExporter commented 9 years ago
Not in any meaningful way, but it's still one b2cross less :)
Anyway, I was more concerned with the useless mass center retrieval that 
littered a bit my user code when using composite shapes.

Original comment by tommaso....@gmail.com on 26 Jun 2011 at 7:10