Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Destek99 on August 15, 2019, 08:00:25 AM

Title: Confusion over global events[SOLVED]
Post by: Destek99 on August 15, 2019, 08:00:25 AM
Hi, I am still learning playmaker so please bear with me.
I am developing a little app for the Oculus Go and so far have a controller set up with the following state machine
(https://i.imgur.com/y2IO4JQ.png)
One of the problems is that there is no way to use the Oculus Go controller in play mode, so I have added a "Get Button Down" action mapped to [RETURN] to test the loop, it all works fine and when it hits, the raycast records the hit object and hit location.
(https://i.imgur.com/5b4NPAa.png)

I am now trying to make my movement mesh on the floor, so I have a new state machine in a different object that starts with a "RaycastHitSomething" global
and that jumps straight to a "Move Towards" action rather than waiting for an actual hit on the object.
(https://i.imgur.com/5jh7FkB.png)


I hope this all makes sense in what I am trying to do
Title: Re: Confusion over global events
Post by: daniellogin on August 15, 2019, 08:28:28 AM
OK so keep in mind that the START state always... starts. That means 'state 1' is firing before the 'RaycastHitSomething' global event.

I'm asuming that's not what you wanted, so instead you need to leave your START state blank. Call it 'idle' or something. It sits there doing nothing until another event gets activated by the global event transition.

You can then have that action with the movement transition back to the same 'idle' state to do nothing again until the global transition happens again.
Title: Re: Confusion over global events
Post by: Destek99 on August 15, 2019, 09:12:59 AM
I got it thanks  :)
OK so keep in mind that the START state always... starts. That means 'state 1' is firing before the 'RaycastHitSomething' global event.

I'm asuming that's not what you wanted, so instead you need to leave your START state blank. Call it 'idle' or something. It sits there doing nothing until another event gets activated by the global event transition.

You can then have that action with the movement transition back to the same 'idle' state to do nothing again until the global transition happens again.
Title: Re: Confusion over global events[SOLVED]
Post by: Broken Stylus on August 18, 2019, 03:02:43 PM
Little trick I learned late but it will change your life.
A global event can be made to work only if the FSM is in a given state. How? Add this global event as an exit transition, not as a global event.
As surprising as it sounds, the FSM will be listening to this global event but only if the flux is in the state that uses this event as an exit. In other words, this event will work both as an entry and an exit point, into and from this state.
'Global' is a hell of a misnomer really since non-global (therefore local) events can be used too.
Also, once an event is added to the Events list (not the one in the Graph window but the PlayMaker general tab dedicated to events), if you make this event global (tick the box to change its status into a global event), chances are you won't be able to unglobalize it. And don't hope renaming it either. :)
So be very careful how you name your events and which ones you use.