2
$\begingroup$

How can I create a logic brick setup for a looping animation of an object going back and fourth?

For example, I want my object to start along the y axis at position 0, and move 0.1 units over 120 logic ticks. Then, over the next 120 logic ticks, I want my object to move back along the y axis to position 0, effectively creating a looping back and fourth animation.

$\endgroup$
2
$\begingroup$

you can use the action actuator set to ping pong. It plays the animation once through properly, and then plays it backwards. The tricky thing here is the correlation from frames to logic ticks. If you left the default settings, there will be 60 logic ticks per second, and 20 frames per second. 120 logic ticks is exactly 2 seconds worth, so we need 40 frames to be 2 seconds worth of frames. make an animation of your object that is 40 frames long.

enter image description here

On the action actuator, set the start frame to frame 0, and the end frame to frame 40. Now, your animation will play through from frame 0 to 40, then will play it backwards from frame 40 to frame 0, looping endlessly.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Do also note that you could also animate your object on frame 0 through 40 going .1 along the Y, and then frames 40 to 80 going back to 0 along the Y. Then play the animation normally from frame 0 to 80. $\endgroup$ – X-27 wants to Reinstate Monica Mar 19 '16 at 16:58
  • 1
    $\begingroup$ You do not need to enable [True Level Triggering]. The actuator will play until receiving an explicit deactivation. $\endgroup$ – Monster Mar 22 '16 at 7:15
1
$\begingroup$

You could also do this with programming using two states each containing a delay sensor set to 120 ticks and the corresponding motion actuators set to .0083 on the y and -.0083 on the y. enter image description here

both states would be almost identical with only the value of the set state actuator and motion actuators changing

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.