ActionTask delta time.

Forums 💬 NodeCanvas 🗨️ General Discussion ActionTask delta time.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #13281
    karolstola
    Participant

      Hi!
      I was wondering if there is some generic way of obtaining delta time from inside of the ActionTask. As graphs can be updated in different modes, it can be buggy to use Time.deltaTime in actions spanning across several frames. I know that it is possible to calculate it using ITaskSystem.elapsedTime, but it has to be done for every single task independently. What would be nice is to have deltaTime next to elapsedTime in ITaskSystem.

      #13285
      Gavalakis
      Keymaster

        Hey,

        Graph actually does have a “deltaTime” property, thus it is easy to add it to the ITaskSystem interface. You can do this by the following changes:

        In ITaskSystem.cs, add:
        float elapsedTime { get; }

        In ActionListPlayer.cs also add:
        public float deltaTime => Time.deltaTime; (we need this since ActionListPlayer implements ITaskSystem).

        Let me know if that works for you 🙂
        Thanks!

        #13284
        karolstola
        Participant

          That’s really cool. Will it make it to some next version? I just wanted to be calm about the change disappearing after update.

          #13283
          Gavalakis
          Keymaster

            Hey,
            Yes, this will be there in the next version of course 🙂

            #13282
            karolstola
            Participant

              Perfect! Thanks a lot.

            Viewing 5 posts - 1 through 5 (of 5 total)
            • You must be logged in to reply to this topic.