Repositioning physics bodies

About Monkey 2 Forums Monkey 2 Code Library Repositioning physics bodies

Tagged: , , , ,

This topic contains 0 replies, has 1 voice, and was last updated by  DruggedBunny 1 month, 1 week ago.

Viewing 1 post (of 1 total)

  • Author

    Posts

  • #15870


    DruggedBunny

    Participant

    Quick sample that allows repositioning of physics bodies, which I didn’t think was possible until now.

    Main intent is to avoid reallocation of physics bodies, allowing re-use.

    Don’t rely on this — not heavily tested!

    EDIT: This was failing inconsistently on independent program runs. I’ve revised it and it now seems much more reliable.

    You just include the Entity class extension below, then call the reposition and/or reorientation methods from your entity. (If no RigidBody is attached, nothing happens.)

     

    Demo… the point being that the rigid body is being manually re-positioned, instead of having to re-create it:

     

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.