Search Unity

Is there a clear procedure for runtime physics creation?

Discussion in 'Physics for ECS' started by nyscersul, Nov 18, 2019.

  1. nyscersul


    Oct 17, 2018
    Specifically, if i wanted to create an object which has many parts, some of which may be destroyed individually, and possibly be recreated using externally tracked data, how would i go about it with basic unity physics? We are talking spaceships!

    Im using the newest version of unity physics as of now, and currently 2019.3b10 i think.

    I need to create objects which will be able to be dismantled and rebuilt, essentially, however there is no need for this to be a fluid motion - decoupling might be a good way of considering it, the links between them can be damaged. In the case where the links are not damaged, however, the object's are completely rigid, except for a few parts which may rotate during use.

    For the animated parts, i am content to use a singular box or capsule if needed which encompasses the rotating part, but i would prefer to know how to use the system to appropriately achieve this, as it seems the online information is conflicting.

    Should i use a compound collider, and somehow recalculate it from scratch when the body's shape changes? Should i use multiple bodies using links maybe via the joint api? Just using joints that dont move.

    As a hint, my simulation does not involve an extensive number of individual entities, and my scope for using multiple entities on a single object is high. I also would prefer to differentiate between which collider within the body was hit by raycasts etc, but have the entire body respond to applied forces.