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 Answers 2

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.

$\endgroup$
2
  • $\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$ Commented Mar 19, 2016 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
    Commented Mar 22, 2016 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

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .