make some Tasks to run On Update as well

Forums 💬 NodeCanvas 🗨️ General Discussion make some Tasks to run On Update as well

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #14197
    chocolacode
    Participant

      Hi there,

      I am making a game where I need to pick an object with the mouse in 3d space. I am using the WaitMousePick Action to detect the current position,
      then as I move the mouse on the screen I need to read the location of the mouse every frame while is pressed.
      Then every frame I need “decompose the vector”, “compose a new vector” with a new y position and assign the new vector(Set Property-Transform position) to a new spawned object,

      my challenges are that the current WaitMousePick Action works with the Method GetMouseButtonDown which only returns true the first time the button was pressed. I need to copy the WaitMousePick Action to a new one and add/change the method GetMouseButton which then returns true every frame the button is pressed

      Also the following Tasks : Decompose Vector, Compose New Vector, Get Property and Set Property don’t have the OnUpdate() method

      If you think this will benefit some other users, May I suggest to include in the standard package the OnUpdate events in the tasks mentioned above and to include another task for WaitMousePick with GetMouseButton method

      I am making copies of such Tasks in the meantime, am including a boolean option “repeat” which will be validated in the OnExecute() event. If you have better idea please let me know

      thanks!

      #14200
      Gavalakis
      Keymaster

        Hey,
        If you are referring to using those tasks in the context of an FSM, have you tried seating the FSM state to “Repeat” as a whole? Doing this will repeat all State actions probably achieving what you are after.
        Let me know.
        Thanks.

        #14199
        chocolacode
        Participant

          hey,

          thanks for the hint! that worked out very well… 🙂

          The tasks: Decompose Vector, Compose New Vector, Get Property and Set Property worked fine with the “repeat” setting. However the WaitMousePick task still need to be copied into a new one that senses the GetMouseButton method rather than GetMouseButtonDown. I made the copy of this task and my project is working as expected,

          I have a question though…What about if there is a case where I need to repeat only certain tasks in the state but not all?

          thanks again for your support!

          #14198
          Gavalakis
          Keymaster

            Hey,

            Glad to know it worked for you.
            Well, the current FSM design in NC is State-centric. What I mean by that is that either the state repeats as a whole, or it does not 🙂 The actions of the state are just what make the state up, and not to be treated as sub-states (which would be the case if some of them were repeated and some other were not) 🙂

            Thanks as well!

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