Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Question How do I implement Destructible Objects? (with NetCode)

Discussion in 'Physics for ECS' started by krooq, Jun 8, 2022.

  1. krooq


    Jan 30, 2013
    Hi all,

    I've been working on a multiplayer game that will feature a destructible object physics simulation which has been challenging to say the least.

    The general setup I have so far is like this:

    Root Physics Body Ghost (client and server)
    Destructible Primitive 1 (server only)
    Fragment 1 (client only)
    Fragment 2 (client only)
    Destructible Primitive 2 (server only)
    Fragment 1 (client only)
    Fragment 2 (client only)
    The Root is the ghost that moves around doing physics stuff using the primitive child colliders.
    When a Destructible is destroyed it's collider should become inactive on the server and fragments should blast around on the client.

    There are 2 constraints that I'm fighting with:
    1. Network data transfer limits really reduces the number of physics entities (ghosts) you can have
    2. Physics child collider baking makes it hard to "destroy" parts of objects at runtime

    I think this is a decent approach given the network data constraint.
    It means I only have one physics ghost to replicate, all the intense fragmentation physics is done locally to avoid said replication.

    The part I'm really super stuck on how to make part of a compound collider inactive?

    I also want to get some feedback from others that have done similar things.
    How'd you do destructible objects over the network?
    How does the DOTS physics & NetCode teams suggest I do this?