Search Unity

Position/Rotation/Scale stays the same after Attach

Discussion in 'Entity Component System' started by LukePammant, Feb 18, 2019.

  1. LukePammant

    LukePammant

    Joined:
    Mar 10, 2015
    Posts:
    50
    How can I get an entity's Position/Rotation when it is 'attached' to another entity. I see the LocalToWorld values update but the Postion/Rotation/Scale remains the same. I assume that is because they represent the P/R/S in relation to the parent?

    In my jobs how can I get the world P/R/S of the child entity? Do I need to design my systems so that they know that they will be dealing explicitly with child entities and inject the LocalToWorld components into the jobs?
     
  2. LukePammant

    LukePammant

    Joined:
    Mar 10, 2015
    Posts:
    50
    After some more searching I found an answer as to how to get the world poisition/rotation/scale from the LocalToWorld. I'd rather not have to explicitly have my systems know that the entity is a child entity though. Is there anyway around this?

    The way to get the P/R/S from the LocalToWorld component is in this post if anyone else is stuck: https://forum.unity.com/threads/entity-transform-to-gameobject-transform.566344/

    @dartriminis said:
     
    Last edited: Feb 18, 2019
    thelebaron likes this.