Center of mass

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
varpeti
Prole
Posts: 4
Joined: Mon Jan 25, 2016 8:00 pm
Location: Hungary
Contact:

Center of mass

Post by varpeti »

Hello!
I have a little problem:
When i was trying to attach a Shape to a PolygonShape Body, the Body's mass center, wasn't changed.

I tried using

Code: Select all

body:resetMassData()
but it isn't work.

Image
On the right: Circle shape was created with body before polygon was attached.
On the left: Polygon shape was created with body before circle was attached.
Filled circles: shapes mass center. (calculated)
Small circles: bodies mass center. (getWorldCenter)
Big circles: bodies position. (getPosition)

Thanks for your help!
Sry4MyBadEng :3
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Center of mass

Post by raidho36 »

Seems like a bug. You can however set mass data manually.
User avatar
varpeti
Prole
Posts: 4
Joined: Mon Jan 25, 2016 8:00 pm
Location: Hungary
Contact:

Re: Center of mass

Post by varpeti »

Yeah, i'll do that.

P.s.:
I create a polygon shape with "kinematic"a circle shape with "dynamic" type. Thats why the difference. -_- (wanted a rubber duck)
Sry4MyBadEng :3
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Center of mass

Post by raidho36 »

Well that actually may be your issue - kinematic objects are meant to be moved around manually and are not supposed to react to other objects. Try using dynamic bodies for both of them.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests