Hey I have this rigidBody(Black triangle) that flies and it spins, but I want one edge of it to always look at the bottom so I thought if I could like put a weigh(red triangle) on that side it would do that, but I don’t know how I can do that help, please
I asked the same question before but nobody answered so I repost with a different style
I never used physics with cocos creator… but in cocos2dx and box2d I would do this by adding multiple fixtures to the body… the red triangle (fixture) with more weight than the other ones.
Did you means that you want a corner always at the bottom no matter how you rotate the triangle physical.
if that is your means,you can change the mass center of the triangle to realize it.
change the center of mass like this, and use a downward gravity.
you can customize engine,used the box2d api “SetMassData” to set the center.like
var massData = this._b2Body.GetMassData();
massData.center = b2Vec2(x,y);
this._b2Body.SetMassData(massData);
ps:attention to the unit,use the “PTM_RATIO”(pixel to meter)
Well this would work but i need it to fly so i’m gonna try moving the center on the opposite side. if this doesn’t work like i want it to i’ll try using fixtures and if that doesn’t work i’ll let you guys know Thanks
hey @Big_Bear i’m still waiting for your reply thanks
@slackmoehrle hey ok i think can you tell me more about fixtures because i can’t find anything about them that i understand any JS documents for that? (edited since i can’t reply more than 3 consecutively)
edit: sorry for being a pain in the ass but this is kind of what’s holding me on development of the game and i kind of have this goal to publish it before new year because i’ve been procastinating for too long