Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

How to binding GameObject's Tranform to Entity's Translation?

Discussion in 'Data Oriented Technology Stack' started by ThreeIce, Aug 15, 2019.

  1. ThreeIce

    ThreeIce

    Joined:
    Aug 15, 2019
    Posts:
    8
    I'm using ConvertToEntity. There are some components that I don't have the ability to change them. These components use Transform to work. And my ecs code use Translation to work.
    I found that when I change the value of Translation, the value of Tranform don't change. And when I change the value of Transform, the value of Translation don't change.
    So How can I make the value of them same?
    Or I should use GameObjectEntity? (GameObjectEntity doesn't have Translation component)
    Thanks.
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    2,267
    Add a CopyTransformToGameObject in your conversion
     
  3. ThreeIce

    ThreeIce

    Joined:
    Aug 15, 2019
    Posts:
    8
    But it depend on GameObjectEntity
     
  4. Deleted User

    Deleted User

    Guest

    CopyTransform* only works if you want to copy in one-way. Either from translation to transform or transform to translation. It doesn't work both ways. If you want to sync them both ways, you need to manually copy position data between them.
    Look at the source code to see how CopyTransformToGameObject works and you will get a good idea of how you should implement it.
     
  5. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    1,999
    Tertle not told you about proxy. He told you about component, which not depend on any thing.
     
unityunity