Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved On the mapping between motions and dynamics

Discussion in 'Physics Previews' started by Baggers_, Aug 17, 2020.

  1. Baggers_

    Baggers_

    Joined:
    Sep 10, 2017
    Posts:
    98
    context: I'm using Unity.Physics without Entities

    Hi, I'm wondering if the mapping between Motion and dynamic-body is always by index or if there is something I've missed.

    In the code fro BuildPhysicsWorld I saw this comment:

    Code (CSharp):
    1. // Dynamic bodies.
    2. // Create these separately from static bodies to maintain a 1:1 mapping
    3. // between dynamic bodies and their motions.
    And I wasn't sure if this is always the case or if this was just their choice in this case.

    I've been assuming the former as I haven't yet found any other index between motions and bodies.

    Cheers.
     
  2. petarmHavok

    petarmHavok

    Joined:
    Nov 20, 2018
    Posts:
    461
    Yeah, dynamic bodies are always the first N bodies in the bodies buffer, so their indices (0 to N-1) map to the index in the MotionDatas and MotionVelocities buffer. That is always the case.
     
    AlanMattano likes this.
  3. Baggers_

    Baggers_

    Joined:
    Sep 10, 2017
    Posts:
    98
    Perfect. Thanks again for the help
     
    petarmHavok likes this.