Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: nelsonn on January 12, 2017, 03:42:05 PM

Title: Continuous update/Tick/every frame?
Post by: nelsonn 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...
Title: Re: Continuous update/Tick/every frame?
Post by: jeanfabre 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
Title: Re: Continuous update/Tick/every frame?
Post by: nelsonn 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?