Is there a way to cast a b2Body to an Objective-C object
box2d, objective-c
Solution
You can use NSValue's `valueWithPointer`
NSValue *bodyValue = [NSValue valueWithPointer:body];
[bodiesArray addObject:bodyValue];
and get your b2Body object back
b2Body *body = (b2Body*) [[bodiesArray objectAtIndex:0] pointerValue];
Problem
I need to iterate through certain bodies. For that I want to add those bodies to an NSMurableArray. But as NSMutableArray accepts objective-c objects only, I need a way to cast b2Body to id. Trying `[bodiesArray addObject:(id)body];` does not help.