b2body

General discussion about Box2D tutorials
Post Reply
vkreal
Posts: 66
Joined: Sun Jan 13, 2013 7:29 pm

b2body

Post by vkreal »

Whats the best way to recreate/clone a sensor b2Body into a dynamic b2Body? one idea just destroy old body and recreate dynamic with same properties.

Thanks!
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: b2body

Post by iforce2d »

If the body is very simple, just creating a new one might be ok, but if it has a lot of fixtures it would probably be easier to use the b2dJson utility. See the section about replicating bodies: http://www.iforce2d.net/b2djson/#replicating You could then change the type to dynamic after it has been replicated.
Post Reply