playMaker

Author Topic: Counting stay time On Trigger Stay  (Read 2667 times)

mekoid

  • Playmaker Newbie
  • *
  • Posts: 35
Counting stay time On Trigger Stay
« on: March 30, 2015, 07:09:25 AM »
Hi
How can I count the trigger stay time when an object stays in the trigger?
The "Get Time Info" action provides "Time In Current State", but this action has to be entered after On Trigger Stay. Not sure where to go from here.

Any ideas please? Thanks!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Counting stay time On Trigger Stay
« Reply #1 on: March 30, 2015, 07:26:06 AM »
Hi,


when you enter the state, you set a "timer" float variable to 0 once ( the action is not set to everyframe), then you add the delta time  of the "get time info"  to it as long as your are in that state.

this will give you the seconds you spent in that state.

 use the ConvertSecondsToString to get a nice formated string version of it if you want to display it on screen.

Bye,

 Jean


mekoid

  • Playmaker Newbie
  • *
  • Posts: 35
Re: Counting stay time On Trigger Stay
« Reply #2 on: March 30, 2015, 08:32:11 AM »
Great! Thanks so much for your help!!!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Counting stay time On Trigger Stay
« Reply #3 on: March 31, 2015, 01:50:16 AM »
Hi,

 note: I tend to avoid using STAY events because they are fied everyframe, and within Scripting it make sense, but in PlayMaker you should use the ENTER and EXIT as discrete information, when you get ENTER it means you are in STAY until you get EXIT. Your fsm will be free to do what ever during that STAY perios and not be forced to be on that STAY state.

 Bye,

 Jean