Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Ashims

Hi Guys,

I'm attaching two entities that have Box2d physics enabled on them using a simple...

this.body.SetXForm(this.carriedBy.body.GetPosition(), 0);

...and its giving me some funky physics problems, which I'm assuming are to do with the entity "being carried" still having its physics enabled. I can't however find details on how to disable the body collisions.

I've tried freezing it, destroying it, and throwing various m_types at it, but I'm really working blind here. Can anyone perhaps give me a little direction on how this sort of thing would normally be achieved with box2d?

1 decade ago by Ashims

A little more info about the physics symptoms-- when I pick up the object (and at this stage strap it to its parent) it starts pushing the parent object to the left. I'm assuming this is the collision detection of the two objects working against each other.

1 decade ago by Ashims

In the end I've decided to kill the entity completely and spawn a copy of the tile on top of the holding entity. Then when the holding entity drops it it spawns a new one.

Would still be nice to know if there is a simpler way of doing it. :)

1 decade ago by dominic

You could remove the carried entity&039;s #body from the box2d world and point it to the carrying entity's body:

ig.world.DestroyBody( this.body );
this.body = this.carriedBy.body;

This way, both entities will share the same physics body, but will still draw as two separate entities.
Page 1 of 1
« first « previous next › last »