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.

Unity Physics Example - Ragdoll Demo - How are they being spawned?

Discussion in 'Physics for ECS' started by LongAndHappy, Sep 19, 2020.

  1. LongAndHappy

    LongAndHappy

    Joined:
    May 10, 2019
    Posts:
    6
    I've been looking through the RagdollDemo.cs and I don't understand where the ragdolls are instantiated in the code.

    Code (CSharp):
    1.     private void CreateRagdoll(float3 positionOffset, quaternion rotationOffset, int ragdollIndex = 1, bool internalCollisions = false)
    2.     {
    3.         var entities = new NativeList<Entity>(Allocator.Temp);
    4.          // Setting up the colliders & joints and storing them in var entities.
    5.          //  
    6.      }
    There are multiple spots where CreateJoint(hinge, bodypart1, bodypart2), but the function doesn't instantiate any entities, it just creates the PhysicsConstrainedBodyPair between the two entities.

    Any reference to entityManager is used as either a SetComponentData or a GetComponentData.

    Is there another way of instantiating these entities without using the entity manager that I don't know about?
     
  2. LongAndHappy

    LongAndHappy

    Joined:
    May 10, 2019
    Posts:
    6
    Nevermind. I forgot about CreateEntities...
     
    petarmHavok likes this.