Forum rules - please read before posting.

Making an object go back and forth

edited October 2017 in Technical Q&A
Hi, 

I have looked at the "making a door close after a set time" tutorial, but I have an object I want to move back and forth every ten seconds. I have tried to find this in the manual, and I have looked into parameters as a saw a post on timers from 2015, but I just cant seem to figure this out, and I feel this shouldnt be too hard. 
What is the best way to make this movable object "loop"?

Comments

  • Parameters should only come into it if you want to "recycle" the behaviour on different objects, but I recommend that even if you do, you should get things working on just one object - without parameters - before incorporating them.

    Do you have any images to share that show what you've tried so far?  It may be that we can advise what you've done wrong.

    But there are a couple of ways you can do it:
    1. Use Actions in a loop.  The Object: Transform Action (to move one way), followed by an Engine: Wait (to pause X seconds), then another Object: Transform Action (to move back), another Engine: Wait, which then loops back onto the first Object: Transform Action.  If the ActionList's When running field is set to Run In Background, then it will play indefinitely without interrupting gameplay.
    2. Animate it.  Attach an Animator to the object, and use Unity's own Animation system to animate the whole movement.  Then make it the default animation in your Animator, or use AC's Object: Animate Action to trigger it if you only want it to begin moving at a certain point in your game.
  • Ah, great! Number one was what I was doing first, but then I thought that to make a loop back to the first action would mess up something in the code or something (dont know why, maybe it was just too easy?), so I started to look for other ways of doing it. 

    Thank you! 
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.