Deactivate physics on object?

edited November 2011 in Help request
Hello everybody,

Is there a way to deactivate the physics on an object? I have some bullets that should disappear on collision, but sometimes they are part of two or more events (instead of only one). I would like to only get the event handler called once, and inside the handler deactivate this object so I can be sure it will not touch anything else ever again.

More generally, is there a way to access the Body of an Object at runtime?

Thanks,

Comments

  • edited November 2011
    Hi!

    You can access any component stored on an orxOBJECT by calling orxOBJECT_GET_STRUCTURE.

    In this case, to get a body, you need to call:
    orxBODY *pstBody = orxOBJECT_GET_STRUCTURE(pstObject, BODY);
    

    In your case you probably want to modify the flags/mask of your body when you get the collision so that future collisions will be filtered out.
Sign In or Register to comment.