Turning off physics solid on a body part?

edited February 2015 in Help request
Heya guys... really tired so can't figure this out... and I'm probably going about it the hard way, I need to turn off the solid setting on a body part after a particular collision.

The object needs to temporarily dead, the body part no longer affected by collisions. I tried the following:
orxSTRUCTURE *structure = orxSTRUCTURE(ballObject);
	orxBODY *body = orxBODY(structure);
	orxBODY_PART *part = orxBody_GetNextPart(body, orxNULL);
	orxBody_SetPartSolid(part, orxFALSE);

But the body variable comes back == orxNULL.

What's a better way to do this?


  • edited February 2015
    not sure if Box2D allows this,
    but you can probably change the checkMask/selfMask so it doesn't collide with anything
  • edited February 2015
    Thanks, Lydesik. Yep was considering either the solid or changing the mask. Either way I need to get the body.

    Iarwain couldn't post from where he was, but he sent me through the answer:

    orxBODY *body = orxOBJECT_GET_STRUCTURE(someObject, BODY);

    This is a macro that retrieves the type you want by supplying the object and required type.

    Located here in the object section of the API:

  • edited February 2015
    As a side note, Box2D is supposed to support swapping between solid and "sensor" (through the SetSensor() method), though I don't remember if I've tested it at runtime when I wrapped it. :)
  • edited February 2015
    Is it wrapped in the orxBody_SetPartSolid function?

    If so I can test it in the next few hours.
  • edited February 2015
    Yep that works out pretty well.
Sign In or Register to comment.