- Home /
Sword animation when falling
Hi, you know how in Minecraft, the first person sword has this "falling" animation when holding on to something when you fall through the air?
I need to create an animation for my sword that can do such a thing. I don't think I can set the animation to a loop, because as you can see in the game, the object gradually moves up to a point and stays at that spot until you collide with the ground.
I can't seem to find out how I can do that. Must I create some 'for' loop that will change the position of it, or is it possible to do this by animation? Thanks.
Answer by Jake.OConnor · Dec 10, 2012 at 06:12 PM
You could either create two animations, one for the sword moving up (while falling) and one for the sword moving back down (once grounded), then call them at the proper times, or you could make one longer animation that does both and manually set the current position of the animation using AnimationState.Time.
I would opt for the first option with the two animations, as it involves less coding and timing.
Both of your answers are really good. I've been trying to use it, but it's not working right. I might post it here soon if I cannot any solutions.
Answer by sparkzbarca · Dec 10, 2012 at 04:29 PM
dont set it too a loop. animate the object up and then leave it that way until you hit the ground.