playMaker

Author Topic: Continuous update/Tick/every frame?  (Read 1566 times)

nelsonn

  • Playmaker Newbie
  • *
  • Posts: 31
    • check out my portfolio :)
Continuous update/Tick/every frame?
« on: January 12, 2017, 03:42:05 PM »
Hi there,

I want to have a GameObject look at the position the player is touching/clicking the screen. That's simple enough to do.
However, I want the look at to be updated as long as the left mouse button is held or the finger is on screen.

What would be the best way to do this?

My idea was to set a global boolean and check it in another FSM. Whenever I detect that it's true I would then update the look at direction, wait for 0.x seconds and check the boolean again. This seems like a very dirty hack, though...

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Continuous update/Tick/every frame?
« Reply #1 on: January 13, 2017, 01:52:20 AM »
Hi,

 yeah, there is a better way :)

 have a state that listen to the left mouse button, transit to another state when down, in that state, listen to the left button button up and transit back to the first state.

 now you have a finite state machine that has an active state only when the left button mouse is down.

you can do your look at in that active state.

Bye,

 Jean

nelsonn

  • Playmaker Newbie
  • *
  • Posts: 31
    • check out my portfolio :)
Re: Continuous update/Tick/every frame?
« Reply #2 on: January 13, 2017, 06:55:53 AM »
But wouldn't that still only execute my 'Smooth Look At' only once?
I mean if I use Get Button Down or something it only fires once if I keep the button pressed, right?