Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Any way to effectively pool ragdolls?

Discussion in 'Physics' started by StarManta, Jan 21, 2015.

  1. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,758
    I've been optimizing a game wherein ragdolls are thrown. Most of the performance issues are regarding instantiations. When I tried to reuse a ragdoll as part of an object pool, though, it seems as if its joints are being reset when I bring it back to the original position, but they're being reset in a bizarre way that makes the newly-reset ragdoll look freakish.

    Has anyone used ragdolls with object pooling before? What's the trick?
     
  2. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,542
    Hi,

    In Start(), make note of localRotations of all the bones of the character. Before you reactivate the ragdoll, rotate all bones back to their default localRotations, so the joints will be re-initiated the same way as before.

    I agree with you though, I don't know why the joints are re-sampled when the GameObjects are reactivated.
     
    Bamboidski likes this.
  3. Bamboidski

    Bamboidski

    Joined:
    Oct 26, 2019
    Posts:
    8
    7 years later your post was the solution to my ragdoll pooling problem. Awesome!