Search Unity

Tweening using dots

Discussion in 'Entity Component System' started by SubPixelPerfect, Sep 7, 2019.

  1. SubPixelPerfect

    SubPixelPerfect

    Joined:
    Oct 14, 2015
    Posts:
    224
    Is there any ready solution or at least recommendations on how do deal with tweening.

    I'm talking about both sequential or parallel changes to component values of an entity,
    something similar to http://dotween.demigiant.com/ but using pure data-oriented approach.

    Imagine a box that has to move up by 100pixels within 500ms then rotate 180degrees within 250ms, and then move down seme 100px/500ms and then get destroyed.

    In OOP way it can be done using coroutines, but what about ECS?
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,780
    I am not sure why would you use coorutines for such basics task in OOP.

    But in DOTS you mainly operate on entities. There were multiple solutions on the forum. Myself I did mapping to NativeArrays and was able to control Game Objects from ECS systems. That was mainly because of PhysX.

    What is your application for OOP, that you require Tweening?
     
  3. SubPixelPerfect

    SubPixelPerfect

    Joined:
    Oct 14, 2015
    Posts:
    224
    I DO NOT need to control Game Objects from ECS systems... I'm talking about pure ECS.

    I need to be able to define a sequence of changes to an entity (each change happen smoothly over time) and then playback that sequence, and also I need to handle the sequence end.
     
  4. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,761
    I was intending to work on this with my prototype (pretty unique) tweening solution I wrote a couple of months ago but I haven't had a chance unfortunately. Maybe I'll see if I can find some time next week.

    BTW my solution is fake component inheritance similar to unity physics allowing different tween components to exist in the same buffer.
     
    Last edited: Sep 8, 2019
    SubPixelPerfect likes this.
  5. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,235
    SubPixelPerfect likes this.
  6. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,761
    This solution is fine and will work for most people however, it does not do what SubPixelPerfect is asking (chaining them back to back). Also there are a few other limitations I've discussed here.

    https://forum.unity.com/threads/showcase-tweening-progress-and-performance-optimizations.711788/
     
    SubPixelPerfect and MostHated like this.
  7. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,235
  8. SubPixelPerfect

    SubPixelPerfect

    Joined:
    Oct 14, 2015
    Posts:
    224
    Thank you @MostHated PlasticTween looks like a good point to start, and it will work for many cases
    @tertle Yes most tricky part here is sequencing, looking forward to hearing some news on your solution.