playMaker

Author Topic: itween actions for door movement  (Read 4652 times)

cardo

  • Playmaker Newbie
  • *
  • Posts: 19
    • View Profile
itween actions for door movement
« on: January 03, 2017, 02:08:29 PM »
Hi all,

First post here so expect plenty of noob questions to follow!

I've been trying for a long time to make a basic action to move a door shaped cube via a trigger using itween actions. I've tried a variety of different options with 'move by' and 'move to' but can't seem to find what I thought would be a simple solution.

I can get the door to open fine but biggest issues using 'move by' is re-triggering the door if I leave and re-enter the trigger before it's back in its initial location which then triggers the door to move even further from it's starting place.. I've tried using 'wait' states to allow the door to reset, but then if the player is in the way of the door it ignores that and I get crushed!

Current solution is using 'move to' and having additional invisible brushes as waypoints which just seems like overkill, especially when I start using multiple pieces of door and am triggering them to go left and right respectively.

I know I should probably just be using an animation for the door but was hoping itween could provide a quick fix at least! What am I doing wrong?!  :-[


terri

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • terrivellmann.tumblr.com
Re: itween actions for door movement
« Reply #1 on: January 04, 2017, 03:01:48 AM »
MoveTo will move the door to a specific location, MoveBy will move the door by a specific offset relative to its current position.

Since you'll always be either closing or opening, I suggest using MoveTo.

There would be different ways to do it depending on the game and how the door works, but heres an example:|
Door starts closed. When player is in range the door opens.
Door checks if player is out of range, when so the door closes and goes back to state1

cardo

  • Playmaker Newbie
  • *
  • Posts: 19
    • View Profile
Re: itween actions for door movement
« Reply #2 on: January 05, 2017, 03:41:27 PM »
Hi terri,

Thanks for the reply. That's pretty much what I've been doing but I'm using triggers to activate the door, a wait state for the door to finish opening and then return to the closing/closed state.

My issue with this method is that no matter what state I'm in, if I quickly move in and out of the trigger volume it jumps straight to door open/opening and adds this movement onto the door's current position so I basically end up with the door slid right off somewhere.

As per the screenshot below, my door is using itself as the transform position and moving 1.75 from its position.. I can see what the issue is with it getting/setting the movement based on its current location but don't know how to get around this. Should I be using variables to detect player range rather than trigger volumes or something??



terri

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • terrivellmann.tumblr.com
Re: itween actions for door movement
« Reply #3 on: January 06, 2017, 01:45:10 AM »
On the itween action, you don't need the door to set itself as the transform position, that is something you can use instead of the vector position, I believe it gets overridden if you use both.

So your open action sets to 0 0 -1.75 self space, and close sets to 0 0 0 self space, and yet if you move in and out the door moves into some other position?

cardo

  • Playmaker Newbie
  • *
  • Posts: 19
    • View Profile
Re: itween actions for door movement
« Reply #4 on: January 06, 2017, 04:24:30 AM »
My close state sets it to 0,0,1.75, as setting it to 0,0,0 of it's new relative position I assume would move it nowhere, as opposed to back to it's original starting position. That's why I have a starting state before it's triggered initially, so that it doesn't start at moving by 1.75, if that makes sense?

terri

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • terrivellmann.tumblr.com
Re: itween actions for door movement
« Reply #5 on: January 06, 2017, 06:25:20 AM »
My close state sets it to 0,0,1.75, as setting it to 0,0,0 of it's new relative position I assume would move it nowhere, as opposed to back to it's original starting position. That's why I have a starting state before it's triggered initially, so that it doesn't start at moving by 1.75, if that makes sense?

if 0,0,1.75 is the closed position that is fine, but I believe that if you use MoveTo it doesn't move by 1.75, it moves to 1.75

cardo

  • Playmaker Newbie
  • *
  • Posts: 19
    • View Profile
Re: itween actions for door movement
« Reply #6 on: January 06, 2017, 06:41:55 AM »
Fair point terri! I think I initially had it set up as 0,0,0 anyway but will try again when I get home.

My biggest issue still seems to be that I can leave the trigger volume and re-enter it and progressively push the door further and further away from its initial location and not sure why. Should I be using 'finished' rather than 'trigger exit' in my transitions or something, and link back to a listener type state to check if player is still in trigger volume?

terri

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • terrivellmann.tumblr.com
Re: itween actions for door movement
« Reply #7 on: January 06, 2017, 10:13:45 AM »
that sounds odd, check if you're not using moveBy instead of moveTo when closing

cardo

  • Playmaker Newbie
  • *
  • Posts: 19
    • View Profile
Re: itween actions for door movement
« Reply #8 on: January 06, 2017, 04:20:17 PM »
Checked I was using all the right actions (both MoveTo). I'd copied the action from one state to the other so they were identical apart from the movement vectors. Also tried setting up the closed state as 0,0,0 but as suspected it moved to 0,0,0 from it's new position, so didn't actually go anywhere! :(

As mentioned, thought this would be one of the simplest things I could do in Playmaker but is causing me no end of grief! If you've got any other suggestions on how to achieve it please let me know - appreciating the assistance!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 5453
    • View Profile
    • jinxtergames
Re: itween actions for door movement
« Reply #9 on: January 06, 2017, 08:20:52 PM »
Hi,
I would use the animator to do the animation and use a animator bool on the trigger.
Which works way better than tweening.
You can set it up in different ways so when the door is open half way and you move out, it will close before it is open all the way, or if you want it go all the way that is also possible.

Or if you really want to use tween you should get Hotween or Dotween.
and tween a float to rotate the door.

terri

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • terrivellmann.tumblr.com
Re: itween actions for door movement
« Reply #10 on: January 07, 2017, 04:02:36 AM »
It is the simplest thing!
There has to be some detail that is being overlooked.

Did you remove the gameobject from the transform position like I mentioned earlier?

I agree with djaydino that other options are better, but this totally works if setup right.

cardo

  • Playmaker Newbie
  • *
  • Posts: 19
    • View Profile
Re: itween actions for door movement
« Reply #11 on: January 07, 2017, 04:29:23 PM »
It is the simplest thing!
There has to be some detail that is being overlooked.

Did you remove the gameobject from the transform position like I mentioned earlier?

I agree with djaydino that other options are better, but this totally works if setup right.

Oh I don't doubt that there's something I've overlooked and it is a simple thing, but just can't figure out a decent solution :) As mentioned, I've had it working, but not a fool proof door that I can't 'break' by messing about in the trigger with.

As for the gameobject in the transform position field - I was only using this because the tooltip on the vector position field says the below..



When I remove this I'm sure I get it flying off to world coords 0,0,0 instead of an offset of itself.

terri

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • terrivellmann.tumblr.com
Re: itween actions for door movement
« Reply #12 on: January 07, 2017, 05:18:11 PM »
did you try it though? thats the thing, if you're constantly using it as an offset, then when you trigger it again, it will offset from the current position, and then you get the weird behavior you mentioned

you could create an empty gameobject in the same spot and use that as the transform position instead

cardo

  • Playmaker Newbie
  • *
  • Posts: 19
    • View Profile
Re: itween actions for door movement
« Reply #13 on: January 08, 2017, 05:11:34 AM »
Hi terri, yeah I actually tried that last night and created an object in the same size and location as the door to be used as an offset but got an even stranger behaviour as the door initially opened correctly, and then moved backwards partly, not returning to its original location.

Might have a play around with the path movement, or just set up waypoints again for it to move to or I'll have to just set it up as an animation as djaydino suggested as not getting far with this way  :)