performance - Box2d custom shape or bodies joint -


let's want create simple physics object shape of "matryoshka" or banal snowman . see , have 2 options it:
1. create 2 circle (or may custom) bodies , connect them weld joint , or
2. create 1 body 2 circle (or may custom) shapes in it.

question is: more expensive cpu: bodies connected joints or complicate-shaped bodies. if have 1 object may don't feel difference in performance , if have many object of type?
know joints expensive , may custom shaped bodies more expensiver? i'm working box2dflash.

since question cpu use, joints use more cpu shapes alone no joint. circles shapes can more efficient polygons in many cases, not all. cpu optimization, use few bodies , simple polygons possible. every normal defined in polygon, calculation may need performed if object overlaps another. circles, maximum of 1 calculation needed.

as aside, unless experiencing performance problems, should not worry if shapes idea cpu use. instead, should ask whether simulation create 1 want happen. box2d contains many many special case optimizations make run smoothly. can decrease accuracy per tick setting velocity , position iteration variables. have far greater effect on efficiency geometry unless geometry extremely complex.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -