Playmaker Help & Tips > Playmaker Help

noob simple opening gate problem... [SOLVED]

(1/1)

wheelbarrow:
Hey all, I have an iron gate in my scene that I want to slide upwards.  I made an animation in Unity, from the closed (down) default position to the open (up) position, then, re the sliding door tutorial, I added a box collider to the gate, made it a trigger, and named my first FSM state  closed, a transition of trigger enter, with the action to play animation open-gate etc; 2nd FSM state was named open, no transition, as this is the end of my scene, so no exit trigger or anything else.  With this scenario the animation would not play, (no errors in PM), so I put the FINISH transition on the 2nd state (open), and the animation ran, but the gate was in the open (up) position before the player entered the trigger, then as the player enters the trigger, the gate would quickly shut and then play the open animation...what am I missing here??  (the auto animate check box in the unity editor is unchecked btw). Thanks for any assist, and apologies for such a noob query :P

Alex Chouls:
It's hard to say without seeing your graph, but try this:

Make 4 states: Closed, Opening, Open, Closing.
Then make an animation for each state.
If you need more details on how to hook this up, let me know...

The examples rely on Unity's ability to blend between 2 animations (closed and open) to smoothly open doors. This lets you have only 2 states, but you lose some control over the opening/closing animations.

If you need animations for opening/closing I'd recommend using a state for each animation, as described above.

Hope this helps!

wheelbarrow:
Thanks for the reply Alex, what you mention about using the 4 states to allow for the blending makes sense... I think ;D  I tried using PM for opening/closing a gate earlier in another part of the same scene, this time with one animation for opening and one for closing on trigger enter/exit (as opposed to just an opening anim in the problem I am having now).  What happened in the earlier attempt with two anims, was that I could not see the gate initially due to terrain, but I could see the state name that is displayed while playing in the editor, and again, at startup, the gate would start open (though the displayed state said closed), and it would immediately play the close animation before the gate itself was visible to me (purely by luck), at which point all worked as it should once I entered the trigger.  Having less than 4 states seems to initiate the animation either at the end state (my current problem), or, in the example I just gave, midway between animations, before it resets itself.  The difference being in the 2 anim case the door resets on its own, whereas my current problem resets on entering the trigger :P  In any case, I will give your suggestion a shot and let you know how it goes.  Thanks again for your reply.

Alex Chouls:
With 2 states the animations are just key framed closed and open with no motion - the motion comes from the blend. Check out the animations used by the door in the TestLab samples, or NoExit.

You need 4 animations/states if you want more control over the opening/closing motion (vs the linear blend). E.g., ease in/out or shake etc.

In many situations the blend (with a nice sound effect) is enough...

Navigation

[0] Message Index

Go to full version