(3D Object) Animation Looping

Not favoritedFavorited Favorited 0 favourites
  • 4 posts
From the Asset Store
Template for a basketball game with a 3D aspect (illusion of 3D)
  • Hello!

    I've set up a game object with the Car behaviour. The object has a 3D Object as a child. The 3D Object has a number of multi-frame animations. I'm using "Key is down" event to trigger steering, acceleration and braking. I've also placed the "Set animation" action in this event, which I'm assuming is forcing the animation to play from frame 1 each tick (and so I don't get the correct looped playback).

    I'm looking for advice on the best way to set this up in my event sheets, where the animations loop correctly, no matter the input event. Any help gratefully received. I have tried using a global variable to store the object's state, and then have that control the object's animation but that does not work either.

    Here's what I have at the moment:

    Thanks!

  • I think one way to do it would be to duplicate what you have, remove the simulate action from one and the set animation from the other. Then add the "trigger once while true" condition to the group with the set animation action.

  • Thanks for the reply. Yes, I ended up removing it all from the simulate events, and added it to a separate set of event. I think it's a bit of a bodge, but it works (for keyboard controls):

    [Animations]

    ----+ Keyboard: ← is down

    ----+ Keyboard: [X] ↑ is down

    ----+ Keyboard: [X] ↓ is down

    ----+ System: carAnim ≠ "Drive.Left"

    -----> Car_Dog: Set animation to "Drive.Left" (playing: True, loop: True, progress: 0)

    -----> System: Set carAnim to "Drive.Left"

    ----+ Keyboard: → is down

    ----+ Keyboard: [X] ↑ is down

    ----+ Keyboard: [X] ↓ is down

    ----+ System: carAnim ≠ "Drive.Right"

    -----> Car_Dog: Set animation to "Drive.Right" (playing: True, loop: True, progress: 0)

    -----> System: Set carAnim to "Drive.Right"

    ----+ Keyboard: ↑ is down

    ----+ Keyboard: [X] ← is down

    ----+ Keyboard: [X] → is down

    ----+ System: carAnim ≠ "Drive.Accelerate"

    -----> Car_Dog: Set animation to "Drive.Accelerate" (playing: True, loop: True, progress: 0)

    -----> System: Set carAnim to "Drive.Accelerate"

    ----+ Keyboard: ↓ is down

    ----+ Keyboard: [X] ← is down

    ----+ Keyboard: [X] → is down

    ----+ System: carAnim ≠ "Drive.Brake"

    -----> Car_Dog: Set animation to "Drive.Brake" (playing: True, loop: True, progress: 0)

    -----> System: Set carAnim to "Drive.Brake"

    ----+ Keyboard: ← is down

    ----+ Keyboard: ↑ is down

    ----+ System: carAnim ≠ "Drive.Left.Accelerate"

    -----> Car_Dog: Set animation to "Drive.Left.Accelerate" (playing: True, loop: True, progress: 0)

    -----> System: Set carAnim to "Drive.Left.Accelerate"

    ----+ Keyboard: → is down

    ----+ Keyboard: ↑ is down

    ----+ System: carAnim ≠ "Drive.Right.Accelerate"

    -----> Car_Dog: Set animation to "Drive.Right.Accelerate" (playing: True, loop: True, progress: 0)

    -----> System: Set carAnim to "Drive.Right.Accelerate"

    ----+ Keyboard: ← is down

    ----+ Keyboard: ↓ is down

    ----+ System: carAnim ≠ "Drive.Left.Brake"

    -----> Car_Dog: Set animation to "Drive.Left.Brake" (playing: True, loop: True, progress: 0)

    -----> System: Set carAnim to "Drive.Left.Brake"

    ----+ Keyboard: → is down

    ----+ Keyboard: ↓ is down

    ----+ System: carAnim ≠ "Drive.Right.Brake"

    -----> Car_Dog: Set animation to "Drive.Right.Brake" (playing: True, loop: True, progress: 0)

    -----> System: Set carAnim to "Drive.Right.Brake"

    ----+ obj_Player: Car is moving

    ----+ Keyboard: [X] ← is down

    ----+ Keyboard: [X] → is down

    ----+ Keyboard: [X] ↑ is down

    ----+ Keyboard: [X] ↓ is down

    ----+ System: carAnim ≠ "Drive"

    -----> Car_Dog: Set animation to "Drive" (playing: True, loop: True, progress: 0)

    -----> System: Set carAnim to "Drive"

    ----+ obj_Player: [X] Car is moving

    ----+ System: carAnim ≠ "Idle"

    -----> System: Set carAnim to "Idle"

    -----> Car_Dog: Set animation to carAnim (playing: True, loop: True, progress: 0)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I think one way to do it would be to duplicate what you have, remove the simulate action from one and the set animation from the other. Then add the "trigger once while true" condition to the group with the set animation action.

    I just wanted to say: I went back and implemented "trigger once while true", and it simplified everything. I didn't know about that event, so thank you!

Jump to:
Active Users
There are 0 visitors browsing this topic (0 users and 0 guests)