Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

How to create dynamic body and collider from mesh in code?

Discussion in 'Physics for ECS' started by pbhogan, Feb 15, 2022.

  1. pbhogan

    pbhogan

    Joined:
    Aug 17, 2012
    Posts:
    386
    I'm creating ECS entities purely in code from procedurally generated meshes and I want to add DOTS Physics components.

    How do I create the relevant PhysicsCollider, PhysicsMass, PhysicsVelocity, etc. components from this mesh in code? Is there an example somewhere of how to do this?

    I've been delving into the authoring components and it looks like a rather complex process. It sure would be nice to have some helper functions that take a mesh and produce the components needed.
     
    Last edited: Feb 15, 2022
  2. StickyKevin

    StickyKevin

    Joined:
    Jul 1, 2020
    Posts:
    24