How to avoid the model to change position on walk animation? - unity3d

I downloaded Raw Mocap Data Asset from Unity from Unity Asset Store
I load any walk animation to my animator and it works fine
the issue is the animation itself changes the model position, I don't want that, I want to move by my own mechanism.
Is there anyway to disable the animation from changing position?

Turn off Root Animation on your animator. Then it will not automatically move.
http://docs.unity3d.com/Manual/RootMotion.html
It is enabled by default.
Uncheckmark here:

Related

Animation changes transform when entering game mode

In my Unity 3D project I've added an animated body as a child to the Player object. The player moves as is should, with the right animations displaying for each key. The problem however is that the transform of the child changes when I enter game mode, meaning the character is walking above the ground. In scene mode it's relative to it's parent, it's grounded, but when I switch to game mode the character suddenly changes it's y-axis transform. I also checked the inspector for this object, it's y-axis changes.
I tried disabling the movement script, to check if this could have anything to do with it, but nothing changes. The transform still changes. I'm new to this problem, and every thread I've found on the topic hasn't helped much. Does anyone know what might cause this?
The hierarchy. mixamorig:Hips is the one changing it's transform. The animations and animation skin I'm using is from Mixamo.

Why do certain sprites ,look as if they're further back in the window?

I am learning how to make games using unity, i have used free sprite packs from unity's store.
i have selected each individual sprite and changed its z position to 0, but when the game runs it looks completely different to how it looks in the editing window.
please help.
Here is a video I recorded.
https://youtu.be/2hb9m01PQBk
Are your sprites on a prefab, or children of another game object? The Transform of the parent object affects the transform of all children.
It looks like this is a camera problem. Your camera is set to perspective, it is possible to do parallax backgrounds with a perspective camera and you may have already accomodated for it, but that is the first thing I would check.
You can modify this by going to your Main Camera and selecting Orthographic from the Projection drop-down menu.

Get Current Animation Frame or Sprite Name

In Unity 2D, is there a way to get the current sprite used either by a SpriteRenderer or an Animation? The idea I have is to have multiple GameObjects to use for a player character, and from the main one which receives animations and the script, edit the others based on the sprite currently used.
Now, I know that to get the current sprite name I can do this:
GetComponent<SpriteRenderer>().sprite.name
But that will only return the sprite used for the main GameObject's SpriteRenderer, and the name of it would not change even as animation changes it in Game Mode
GetComponent<SpriteRenderer>().sprite.name
This 100% does work , just tried it now and it is changing the name for each current sprite that the animator is changing.
You need to give more information and maybe a video since there is a problem somewhere else.

How to create .anim file from Mixamo to Unity?

I download the character .fbx file from Mixamo and add to Unity. I want to get .anim file like
.
I try to drag Idle to the Animation window like, but it cannot paste in the Animation window.
I drag Idle to Animator and make a transition like, but when I test by drag character object to Animator and click the play button it not move.
you are not supposed to have 2 idle states. You should be able to make the idle animation in only one state. Like this 1:
Idle State
I think the problem of your animation is not about the format of the file. When you grab all the frames of your animation or just make it in unity, they will turn .anim file.
If you realize that when you play the game the state does not change from entry to Idle. You can try this:
Click on the animation you created, in the inspector and check if is loop is active 2.
Idle Inspector
Add an animator component in your character object3.
Animator
Create an animation controller [4].
[Create Animation Controller][4]
Drag and drop the animator controller in the controller component.
Open the animator and you should be able to drag your Idle animation to the animator tab where you were in. When you run once again your game you should be able to see the animation running.
Note: Some pictures I took are from unity2d, so probably it is not the perfectly the same inspector as yours, but you should be able to find it out. If you do not or if you still have any doubt, you can check this video. He exports it from blender, but the format .fbx is pretty the same. https://www.youtube.com/watch?v=D-oYgs1CP7U&ab_channel=SingleSaplingGames

How to prefab animations in Unity?

created a prefab for door and added the prefab doors to the scene. This prefab door has an animator. The problem is when I try to change the animator x,y,z position on the second door in the scene it changes the first door.
I tried duplicating the doors and changing the position x y z but it changed the animator for the first door.
I just have a script that play the animator.
The expected result should be that I can drag and drop doors as needed without creating individual animators for each door. It looks like i need to create animators per door there is and also this probably will require me to create new scripts per each door. It seems awkward since I should be able to add doors and just chaning the position x y z in the animator.
The problem is that their Animator component uses the same AnimatorController asset which uses certain AnimationClip asset references for it's states.
I don't know if there is an easier way for achieve but I would do the following:
For what you want you would have to copy the AnimatorController asset (CTRL+D) as well as the AnimationClip asset you want to change.
Then in the cloned AnimatorController click on the according State you want to change and in the Inspector reference the according cloned AnimationClip.
Now you have a copy of the AnimatorController using a different AnimationClip but with the same states, traditions etc. so you can edit both animations and controllers individually.
finally in the Animator component reference the according AnimatorController for each prefab.
The remaining problem maybe is now that for the future if you change the States, transitions and especially parameters you have to do it in both AnimatorController assets individually.
That is perhaps not because of an animator, but a specific behavior of animation in Unity. Animation animates transform property according to parent, as far as I understand. So the first parent of your prefab is captured, and its transform property is used for animation. But I'm not exactly sure about this explanation - the actual behavior is covered under the Unity's source code. A common solution for this that I found is to create a parent or container inside your object's prefab. I don't know why it works, but it works. Perhaps because the parent of your animated object is now always the same.
Parent can be just an empty game object. So you make your door prefab, place another empty game object into this prefab, make your door a child of this container, set 0 for all coordinates of your door according to container and for the container itself. Now you can add an animator component to your object, which you want to animate (not the container), and animate it inside the prefab scene. After that you can place the copies of this prefab (container + your animated object inside) wherever you want inside your game scene - all animations of copies will proceed independently.