How Can i jump my capsule collider with my humanoid character? - animation

Im moving my character with Vector 3 and i have attached an jump animation and also my character jumps amazingly but i want to jump over obstacles animation works fine but my collider is still on the ground? I also want to jump my collider with my character?? Please help me im stuck on this from 2 days

Related

Position of player changes when the attack animation starts - unity

So I did an attack animation in the program Aseprite and everything was fine with the animation, but when I put in inside the animator in unity the character changes position.
Here's the images, first one is a gif with the animation running as I want, and then the before and after of the animation in Unity.
I know it's small but I hope you can see
This is because it's setting the center point at the location, and the gif is wider than the standard player image, you will need to offset to compensate.
So I just sliced the sprites again but with the pivot to the left instead of center, and then adjusted the Collider. It seems to work. Not sure if it's the perfect way though.

Why is the animation playing wierd when I check the root motion check box?

So basically I want to make a prefab (a cat) climb a wall, I wanna do it with basic root motion animation. Since I am new with unity and is my first time doing this I decided that I need to do a little bit of testing without any complicated animations, that being said, I made a simple animation, just moving the cat prefab, in the animation clip the cat is moving one meter on the +z axis.
When I play the animation without the "Root Motion" check box checked it works just fine, but when I play it with root motion active (by the way, I checked the root motion check box and I clicked on "Generate Root Motion Curves") it plays in a different way. Instead of moving on the +z axis is moving on the -Z with a shorter distance and a shorter time as well and on the +y axis it moves a much shorter distance (I forgot to mention that I moved the prefab on the y axis as well, to simulate a very basic "jump" so to speak). I am using an animator to trigger the animation right when the game starts and the animation is set to loop.
Why does it do that and how can I fix it so the animation is played with root motion exactly like it plays without the "Root Motion" check box checked? What am I doing wrong?
The problem isnt with your animation. The issue is that Root Motion uses the animation to calculate the movement.
If your script is telling the cat to move, and root motion is telling the cat to move, there will be a conflict. When using root motion, comment out the portion of your script that is telling the player to move one meter.
This should allow unity to do its calculation and move the prefab accordingly. For an in depth explanation, see https://docs.unity3d.com/Manual/RootMotion.html

How to keep sprites position after Unity animation?

I just recently began using Unity3D and this is my first game, so if I'm not doing things like I'm supposed to, please tell me.
There is a 2D character that I want to move one step forward using the Animation mechanism. This movement can be splitted in two parts :
Move forward the back leg, don't move the upper body ;
Use this leg to push and make the step, moving the upper body.
My problème is that I can't find a way to make this step permanent. As soon as it start looping on the "Idle" animation, then, it come back to the original position (before the step).
I don't know how to let my character stay in the position it was just between the "Step Forward" animation and the "Idle" animation.
I tried to add "Rigidbody 2D", "Box Collider 2D" and "Physics2D Material" on both feet and on the floor, but it somewhat breaks the IK script ("Simple CCD", from the youtube video "Unite 2014 - 2D Best Practices In Unity"). And I'm sure there is a much simpler way.
EDIT: My question was not clear enough. The idle animation is the default animation, where the character is doing nothing in particular. It's just moving a little while it's staying in position. When it runs "Step Forward", all the sprites are moved (only when the back leg is pushing). If all animations are stopped right now, then the character is indeed in a new position, closer to it's opponent. I can check that by removing the transition from "Step Forward" to "Idle". But from here, I want it to loop on the Idle animation. When the transition from "Step forward" to "Idle" is done, the character is NOT running Idle from it's new position, but from it's old position, before the step, as if it was pulled from backward. I want to run Idle from the new position.
Here is a longer gif when we can see more of the Idle animation :
And my Hierarchy panel looks like :
Main Camera
Karateka (the top GameObject container, with the Animator component)
Torso (the sprites)
Head
Right arm
Right leg
Right lower leg
Right foot
...
IK (the Inverse Kinematics targets)
Left fist target
Left foot target
...
Any suggestion is welcome.
If I get it right, you have the StepForward animation running and it gets cut in the middle back to idle. There, the StepForward animation triggers again but from the start and you wish to restart from where you left off:
You can record the normalized value of your StepForward animation and use it next time:
float normValue = this.animator.GetCurrentAnimatorStateInfo(0).normalizedTime;
then you can use that value:
this.animator.Play("StepForward", 0, normValue);
Other possibility, you are not after that but simply you want to pause the animation without getting to Idle.
Use a parameter. You can add a float parameter (call it direction) in the Animator window (top left). Then select a state in the animator, it will open the animation setting in the inspector. Under speed, open the drop down where your new parameter should show up. And tick it.
Now, your direction float will affect the speed of your animation as such:
this.animator.SetFloat("direction", value);
if you give 0, you pause. Give back 1 to move forward. You can also lerp the value so it is not abrupt. Your way.

Unity2D - Player relative animation positioning

I'm making a 2D platformer and I've come across a really annoying problem where if I move my player character GameObject to another location on the scene, my player becomes stuck and the game spazzes out, jumping from the players original location and the position I moved it to.
My player character is made up of many parts, each a separate GameObject. I know the problem is definitely in my animation, because if I disable the animator component, the problem goes away, just I don't have my animations anymore. I believe the problem may be in the player character's Idle Animation and it's position property. There is no script attached where his starting location is hard coded.
How can I make the child Gameobjects move relative to the parent Player GameObject? I cannot move the player in the scene from its original location without the game glitching up.
Here are some screenshots
[Player and it's parts in Hierarchy]http://i67.tinypic.com/bdlc1j.png
[Idle Animation]http://i64.tinypic.com/2gtp99x.png
[Player's original Location, he works if starting here] http://i66.tinypic.com/261jb6c.png
[Player is Moved, game bugs out] http://i67.tinypic.com/292a2c3.png
Try to disable "Apply Root Motion" flag in the Animator component.
The problem should be related to the fact that the animation changes the position values
My guess is that you have animated the different parts by moving then around in the editor and recording that. This meas that the animation is keeping track of the original position at which you did the animation. Try deleting those parts from the animation.
I couldn't fix the spazzy-jittering problem that occurs when I move the player character to another position on the scene, but I did find a way around it. The problem definitely lied within the Animator component and the gameObject's Rigidbody2d.
Instead of moving the player to another position, I instead made a 'Spawn Point' which the player starts from when first playing the scene, and that was able to be moved freely around. Pretty much:
void start(){
transform.position = spawnPoint.transform.position;
}

Unity 3D Model Y Translation when Switching animations

I made an animator for my Player Character, I have 2 differents animations.
When I play only one, nothing, it's cool, the character is doing the animation.
OwnAnimator.SetBool("running", true);
But when I have multiple animation (2), in my AnimatorController, the player goes under the floor instantly at the runtime O_O.
Please someone can help me ? :)
What is your second animation? Since animations can affect the transform position it is possible that your animation changes the Y-axis of the transform.

Resources