0
Answered

how to question regarding animation

cel 4 months ago in Game Creator updated by Marti (Lead Developer) 4 months ago 1

Ok, this is more a "how do I achieve this" sort of question:

I have a a golf player, holding down the golf club ready to prepare the shot( like an idle animation at the beginning), I have a power bar for the shot that goes up and down automatically (think Neo turf masters), I want the golf player to raise/ swing the club according to the value of the power bar, so if the power bar value is low the swing animation just goes up a little, if its high the swing goes higher.

how can this be done in gamecreator?

is it possible to play a single frame of an animation? Like getting the value of the power bar and plug it in to the animation frame

thanks for your time and attention

Unity version:
Game Creator version:

Answer

Answer
Answered

Hi Cel;

This is a very interesting question. The ideal solution, as you mention, would be to input the percentage amount and display that frame of the animation. I think should be feasible to do and I'm opening a ticket to have a look at this.

Meanwhile here's how I would approach it (note: it's not very elegant, but should do the trick).

You probably have an animation going from touching the ball with the golf stick to the full swing preparation, where the stick is over the head. You'll also probably have another animation going from the full swing preparation to hitting the ball.

I would use the "Character State" Action set to Animation clip and have a transition time equal to 0. The animation when preparing the swing should have the same length in seconds than the power-up charge.


Now comes the trick part. Instead of playing a Gesture "do-swing" (which wouldn't work, since maybe the charge is at a 5% and the character would immediately snap the stick over its head and perform a full swing in an instant), you could call a Condition.

This Condition would check how much of a charge you have. For example, if the Charge is over 80% play the full swing animation using a Gesture action. Create another Clause and check for whether the charge is above 50%. In this case, you'll need to duplicate the Full Swing animation and trim half the first part of the animation. After this, do the same in the Else Condition, playing an animation that has the 70% of the animation trimmed.

The trick to make this look good is allowing the Gesture's transition time to smoothly blend between the current pose and the swing animation. A value of 0.15 or 0.2 should do the trick.

Hope this helps! And if you have more suggestions, feel free to drop them below.

Cheers!

Answer
Answered

Hi Cel;

This is a very interesting question. The ideal solution, as you mention, would be to input the percentage amount and display that frame of the animation. I think should be feasible to do and I'm opening a ticket to have a look at this.

Meanwhile here's how I would approach it (note: it's not very elegant, but should do the trick).

You probably have an animation going from touching the ball with the golf stick to the full swing preparation, where the stick is over the head. You'll also probably have another animation going from the full swing preparation to hitting the ball.

I would use the "Character State" Action set to Animation clip and have a transition time equal to 0. The animation when preparing the swing should have the same length in seconds than the power-up charge.


Now comes the trick part. Instead of playing a Gesture "do-swing" (which wouldn't work, since maybe the charge is at a 5% and the character would immediately snap the stick over its head and perform a full swing in an instant), you could call a Condition.

This Condition would check how much of a charge you have. For example, if the Charge is over 80% play the full swing animation using a Gesture action. Create another Clause and check for whether the charge is above 50%. In this case, you'll need to duplicate the Full Swing animation and trim half the first part of the animation. After this, do the same in the Else Condition, playing an animation that has the 70% of the animation trimmed.

The trick to make this look good is allowing the Gesture's transition time to smoothly blend between the current pose and the swing animation. A value of 0.15 or 0.2 should do the trick.

Hope this helps! And if you have more suggestions, feel free to drop them below.

Cheers!