Delete physical Object in Box2d

Previous topic - Next topic

mentalthink

HI, there...

I have a little trouble when I want delete an physical Object created in Box2d... making something like:

If key(57) then b_destroyObjects... the objects destroy, but the program crashes...

But if I do something looking the position like

if physical_position_Y>200
  destroyObject
endif

This last example don´t works, the physical Object continue working in the program...



matchy

I'm only familiar with b_DestroyBody but it should work fine but make sure you are outside all FOREACH loops when you call it.  ;)

Code (glbasic) Select

FUNCTION b_DestroyBody: body%
INLINE
bWorld->DestroyBody(bBody(body));
ENDINLINE
ENDFUNCTION


mentalthink

Thanks Matchy, perhaps it´s for this... I think I delete the physical object into a for...

Thanks a lot...