How to keep the animation at the end without restarting? - unity3d

not loop disable/enable but to keep the animation at it's end frame.
the animation pointing is starting by default but when the state getting to the end the animation ending and not playing again. if i make it loop it will start over again when ending but i don't want it to start over again but to stay on the last frame.
The pointing animation make the player pointing with the finger on a target :
i want the animation to stay at this frame or the last frame so the hand and finger will point all the time and not starting over again.
but this way the hand when the state finish playing move back down.
I tried to enable loop and then to enable also loop pose but didn't work so i tried to change the root transform rotation , root transform position Y , root transform position x-z to bake into pose but nothing of that worked yet.

A working solution is to set the key frames of the animation to the two frames where you want to keep the animation at when playing it.
In my case it's frames 78-79 : I set the frames 78 as the Start and frame 79 as the End. Loop time and Loop pose both disabled unchecked.

Related

Why when creating a new transition back to humanoidwalk state animation the character change position and not keep walking from where he is?

After playing the animation in the state Catwalk Walk Turn 180 Wide R 0 the transition back to the HumanoidWalk but instead of continue walking from the current position the character is kid of sliding to the starting original position he started walking the first time and continue walking from there.
Instead i want that when the animation in the state Catwalk Walk Turn 180 Wide R 0 finished play that the character will continue walking from the current position.
Screenshot of the back transition to the HumanoidWalk state :

Move During playing Jump Animation

So the case is that I have a 36 frames long jumping animation and the jump itself starts at frame 12, where my object raises along y axis.
What would be the most easiest way to move my object forward while it's in air(during frames 12-36)?
How is jumping with animation generally done in games? I don't think my way is the best one. But I would also like to know how its usually done in my way too. Thanks
I have just read the comments and your question. Why not write this code:
Whenever You want him to jump at whatever condition:
Here I'll show you how to do it onClick of Space i.e, whenever you click space the jump animation plays whatever animation you have now the object moving in y-axis
if(Input.GetKeyDown(Keycode.Space))
{
yourPlayerAnimator.setBool("TheAnimatorCondition",true); //Bool for your animation to play if u have a idle with you.
}
if(yourPlayerAnimator.GetBool("TheAnimatorCondition")== true)
{
transform.Translate(Vector3.forward * Time.deltaTime)
}
All these Happens inside void update
Animation transition is your friend.
Put any condition when jumping to move to another animation. In this case i.e. when pressed left displacement key, move from "jump" to "jump&moveleft" or similar and when unpress return to jump state increasing the frames you spent moving to left.

Gradually decreasing the velocity of an object through animation in Unity

I need to create 2 animations,
one is of an object going from point A to point B at a constant velocity.
the other is of an object starting from point A but with a gradually decreasing velocity as it reaches point B until it comes to a stop.
I tried decreasing the animation speed every second to achieve this result with no luck.
Any ideas?
As you may have noticed when you work with animation in Unity there is no such thing as changing the velocity of an object. What you need to do is give your object an Animator and create a new Animation.
Then on the animation timeline press the red dot (record button) and then place your object on point A.
Next, on the time line you want to select the exact second that you want your object to come to a stop and after that move the object on point B.
Now, the more seconds there are in between the 2 keys, the more time it's going to take for the object to travel.
To make it gradually slower instead of it just travelling slowly:
On the animation panel you will see 2 tabs. Dopesheet and Curves. Hit Curves and play around with them till you have a satisfing result.
Documentation on using Curves

SpriteKit move node with physics rather than updating position

My main character moves by touching and holding him and then moving your finger left or right to move the character. To do this I just simply update the node's x position (walks left and right on a flat surface) in touchesMoved() with the x position of the touch location, and apply an animation depending on the direction he's moving.
I want to kind of take this to the next level and accomplish the same effect, but using physics, so that when I'm done moving him and release my finger, he may slide a little bit in the direction he was moving given the speed I was moving him at, if that makes sense. Does anyone know how I can accomplish this effect?
Would I have to do as I'm currently doing and update the position as it moves, but also apply a force/impulse at the same time? Kind of confused on how to approach this
Moving the physics body via force, impulse, or velocity will automatically update the player position.
So you will have to play around with the correct way to accomplish your goal. But based on this, what I would suggest is replace your .position code with .physicsBody!.velocity code in your touchesMoved. Then, on your touchesEnded, you can apply a bit of an impulse to give the player that little bit of an "on ice" effect to keep them going a tad.
You will need to experiment with how much velocity you want to get the character to move at the correct speed, and then you will need to play with the impulse figures as well to get it just right.
This could get a bit tricky though, in touchesMoved... because at some point you will want to reset the velocity to 0 (so they stop moving when your finger stops).
To do that, you will need to to use the .previousLocation from your touch object, and compare the distance of X moved. if the distance X moved is >0 (or some deadzone threshold) then apply the velocity; if the deltaX is 0, then set the velocity to 0.
This may actually be more complicated than just using .position to move the character, then having the character slide a bit with physics on touchesEnded.
You will have to play with it to get it right.

Unity - Animation Loops?

I am using an FBX 3D object file as a game object in my project which have further sub assemblies. Now i want to animate a part of the assembly.
I followed this process:
Select the part which I want to animate.
In the animation panel create one animation.
Add property > transform > position
Using pivot, i move that part to the location where I want to animate.
Challenges
Animate in loop. Moreover if I Select animation file, it does not show Wrap mode
( 1. I don't want any loops in my animation, even after deselecting loop-time it does loop. - I dont know why?
It is animating in reverse. suppose if the object needs to go from position x:3 to position x:8 but it goes from position x:8 to position x:3
the above point happens in loop. just like a ping pong)
Animates in reverse.
I take the whole animation as one loop i.e Part comes out of assembly and goes back and repeating for infinite time.
I want to stop the animation till the point it comes out.
Any help will be appreciated