playMaker

Author Topic: Control check trigger event, "catch player if moved"  (Read 970 times)

Martin-Vaupell

  • Junior Playmaker
  • **
  • Posts: 69
  • Creating CarbonDiOxide
    • View Profile
    • Evisystems
Control check trigger event, "catch player if moved"
« on: January 19, 2014, 07:06:02 AM »
Having a sliding door trigger, all works perfect.

Closed -> opening -> Open -> closing -> return.


But, if a player enters the trigger and initiates the opening sequence but leaves
before it finishes or at once, the door remains open.

So i'm thinking in the "open" state i want to add a Wait, 2 secs. then go
and check if the player is still inside the trigger, so either close or go open.

However,

How do i check if a player is currently in the current trigger?

OnTriggerStay is really only if the play "stays" in the trigger to begin with right?


- Currently I just have a timer, closing the door in any case after a few seconds.
« Last Edit: January 19, 2014, 07:51:54 AM by Martin-Vaupell »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14684
  • Official Playmaker Support
    • View Profile
Re: Control check trigger event, "catch player if moved"
« Reply #1 on: January 21, 2014, 05:22:20 AM »
Hi,

 Usign TriggerStay is a bad idea in most case because it affects performances quite a lot. I would simply maintain a boolean flag that you set to true on trigger enter and set to false on trigger exit, then you can query anywhere else for this flag and know if the trigger is "stay" this way.

also check this, it may give you a lot of ideas and possible ways of creating doors.

http://hutonggames.com/playmakerforum/index.php?topic=3386.msg17944#msg17944

bye,

 Jean