b2body.GetMass() alternative?

Is there an alternative of GetMass in Corona SDK [import]uid: 54636 topic_id: 10864 reply_id: 310864[/import]

What are you trying to do exactly? [import]uid: 27965 topic_id: 10864 reply_id: 39518[/import]

I wanna set custom gravity for different body types, but I need GetMass() to do it [import]uid: 54636 topic_id: 10864 reply_id: 39522[/import]

Gravity is global in Corona so you can’t set custom gravity to individual objects. The only workaround I know of is to apply different constant forces to different objects with the “body:applyForce” API.
http://developer.anscamobile.com/reference/index/bodyapplyforce
Not exactly a simple or elegant solution but it works. [import]uid: 27965 topic_id: 10864 reply_id: 39524[/import]

I know box2d have global gravity. I want to use applyForce on EnterFrame for custom gravity, but I must to know the mass of the object and I need GetMass() to get it. Just need some workaround, because seems GetMass() is not supported by Corona SDK physical body. [import]uid: 54636 topic_id: 10864 reply_id: 39526[/import]

The getBodyMass() feature is fundamental to custom gravity, and should eventually be implemented in Corona SDK.
In the meantime one solution, would be to multiply the area of the shape by the object’s density

Though this becomes difficult, when you introduce complex shapes with something like the SVG editor

If we had something like displayObj:getPhysicsShape() and
displayObj:getMass() it would be awesome.

I really hope the corona developer’s take notice of this thread… [import]uid: 144151 topic_id: 10864 reply_id: 106399[/import]