Mixamo upper body rotation only not working - unity3d

This is my first question on Stack Overflow so I apologise if anything is not to standard.
So I'm a beginner in Unity exploring into intermediate territory.
I am learning Unity by doing a third person shooter but throwing items instead of a gun.
I found the perfect animation pack from mixamo called pro magic pack, which is basically a wizard with casting animations etc.
I have setup the camera, controller etc and I'm working on the animations, to which I have all the jump animations, walk blend tree etc all within MECANIM.
My problem is that I have another layer specifically for upper body movements only so he can run/walk whilst performing an upper body magic casting animation, I have setup the avatar mask for the upper body which works fine, but due to the nature of the animation the upper body rotates as he performs the animation, but this rotation doesn't rotate around the hips he just flails his arms in the current direction the chest is facing.
Is there anything I can do without going down the coding IK's route, or excessive coding (will do this if it's essential)? P.s. I've also tried various checks and unchecks of bake into pose (to which I'm still grasping the understanding of).
Thank you in advance for your help, I've attached some GIF's to understand my issue.
This is the animation I want but only the upper body:
Upper Body Animation I want
This is what I currently have:
Animation I currently have
It seems like the upper body isn't properly rotating and the spine or hips?
Upper Body avatar mask
EDIT: With thanks to Vasmos for pointing me in the right direction, I have found that enabling not just the upper body on the avatar mask but ALSO enabling the ground as seen here: Upper Avatar Mask
I've added this GIF as the current situation, it looks okay and works almost as I want it to, I just need to figure out how to stop the legs rotating with the base: Correct Direction but body rotating with animation
EDIT 2: After research and help from vasmos, the solution I found to this is to enable the Foot IK option of the animation as seen here: Solution to animation affecting rotation

In the throwing animation the movement begins in the root hips bone, it looks like in your mask you just put the upper body when you still need to include the root hip node. It seems like you are on the right path with layers and mask to blend the two animations just keep playing around with it, just incase you don’t have it : https://docs.unity3d.com/Manual/AnimationLayers.html?_ga=2.241528322.1842043308.1588381034-1055993846.1587850410
edit: yeah you are close maybe just remove the hip from the upper body mask and start at the next node up(spine?) and keep moving up one node at a time until you get desired effect

Related

Is it possible to animate anything with natural way in Unity or smt else?

I m wondering that if is it possible to animate anything along the rules of physics.
I mean, i have a cube, and two legs attached to that cube. I want to just animate that legs one after each other, but unity or other software will force its animation system to behave to my animated legs to make my cube walk. I wont change positions for my body(cube) but legs will do that.
demonstration:
https://streamable.com/dda610
Yes, this animation type is called procedural animation. You base your animations dynamically based on physics.
https://en.wikipedia.org/wiki/Procedural_animation
good video:
https://www.youtube.com/watch?v=LNidsMesxSE
tutorial:
https://www.youtube.com/watch?v=9Wh6fzSl_u8
Physically based animation is a complex task. You can use the timeline to animate legs but they won't work too well physically. You probably want to use code to keep the body a fixed height above the surface and use the timeline editor to animate the legs. Or perhaps keep the body at the same height and use 'inverse kinematics' to move the legs in a more realistic fashion. Neither of these options will be very quick for you to start using really effectively if you have very little experience with unity or with code but knowing what to look up is half the battle of learning.

Unity - How to disable animation interpolation / animation curves?

I'm trying to animate a hierarchy of 2D sprites (essentially body parts) by explicitly setting sprite positions at various key frames throughout a given animation clip. Unfortunately, Unity is implicitly changing all of the sprite positions using interpolation between key frames. This causes the sprites to look like they're sliding around rather than immediately transitioning into their correct positions.
So far I've come up with 2 rather poor solutions:
I could potentially create separate animation clips for each combination of sprite positions and transition
between them using mecanim parameters or in
code, but this seems tedious at best and inefficient at worst.
I could add more keyframes (either in the animator tab or in the
curves screen) that maintain each sprite position until just before
they need to be updated. This is a slightly better option but also
extremely tedious.
Is there any way to tell Unity to disable animation interpolation at least as far as positions are concerned? Thanks.
In the current version of Unity (2019.3), go to curves view, right click a keyframe node and select Left Tangent -> Constant. You may want to use Right Tangent depending on the use case. That should give you the instant change you're looking for.
Have you checked Brackeys video of animating 2D in Unity? Maybe it can help you :)
The following link is his video on how to animate 2D sprites.
https://www.youtube.com/watch?v=whzomFgjT50
Alright, I've come to the unfortunate conclusion that Unity forces you to use curves when dealing with animation keyframes and that you need to add an extra set of keyframes for abrupt shifts in animation.

How do I force orbital movement around a point in space, while maintaining forward/backwards capability on a player?

Long-winded question out of the way, I'll provide a diagram of what I am going for:
The red square represents the character, the blue rectangle represents the camera, the green dot represents the center of the "stage", and the black circle is the stage itself.
What I desire is to essentially lock the player's movement around the "center" of the stage, so that anytime you move left or right you are more or less rotating around said center. However, I also want the player to be able to move forwards and backwards to/from the center as well. Keep in mind I want the camera to always stay directly behind the player. I have tried many different methods, and the latest is the following:
I took a default actor, attached a spring arm, attached a child actor to that (gets possessed to become the playable character), attached another spring arm, and finally the camera to that. I then added the blueprint code to the first spring arm so that it was the one being controlled by the left/right controls. However, upon hitting play, the only thing that moves is the camera, and it can only move forwards and backwards.
I'm admittedly pretty new to Unreal Blueprints, so any help would be appreciated.
Alright, I figured it out.
Here's the setup needed if anyone else wants something similar.
For the player themselves, you'll need something like this:
The important thing is to center the root mesh where you want to rotate around. The spring arm's target arm length will be affected for the player mesh movement, giving the illusion you are physically moving the character. The second spring arm isn't necessary unless you wish to have more control over the camera to player distance.
For the rotation Blueprint, you'll need this:
The target is whatever you named the root mesh. (Mine was called Center) Drag and drop it from the hierarchy.
For the forward/backward movement, you'll need this:
The target is what you named the spring arm. (I left mine as the default "SpringArm") Again, just drag and drop it from the hierarchy.
Adjustments in Project Settings:
Yes, my inputs are backwards from what you'd think. I felt it was quicker just to reverse the inputs instead of adjusting whatever was causing the movement to be backwards in the first place. (It's probably just the sphere orientation.) Also, you'll notice I have the w and s inputs set to 5 or -5 instead of 1 or -1. This is due to the fact the movement was slow otherwise. I'm sure there's a fix that doesn't involve changing the input axis scale, but honestly I won't really have a reason to alter the values at any point in my project. If it ever comes up where I do need to, I'm sure there's a bypass to change the values from within blueprints anyways.
End result:
End Result Video
If I remember correctly, child actor components are a bit different from other components in that they are transformation independent, that is they do not update their transformation when their parent component moves around.
I find it a bit strange that you would separate your player actor and the camera component. Normally, the player "pawn" contains the mesh and camera components for one player.
I would suggest you do the following:
Create a player actor (e.g. a "pawn" or "character" class)
Create the following component hierarchy:
Root Scene -> Spring arm -> Skeletal or static mesh -> spring arm -> camera
Your root scene is the green center in your drawing. You can then basically use the blueprint you already have to rotate and move your player.

Looking for loading more scene when node goes above Y

I am looking for a way to make my game load more SKScene when my node (ball) goes above certain Y position.
I'm looking for a way to make the loading a little bit like ColorSwitch game where you tap and the ball loads more screen once you hit a certain Y position.
Use SKCameraNode and have it centered on your scene (or wherever it is you want to look at). Check documentation or search here for more help on setting up your camera.
In update() simply check the position of ball's y value ball!.position.y, if it's past a threshold such as view!.bounds.y, move your camera up by however much camera!.runAction(SKAction.moveBy...)
If you want to scroll back down, it would be a bit more complicated, but the same principles would apply.
(note: I have my stuff as Optionals so your code may not have !)
https://developer.apple.com/reference/spritekit/skcameranode
You could also use invisible boxes and collision detection, but that seems more complicated of an approach to me >.>
If you post some code we can help you get it up and running. Unfortunately, there will be some degree of math involved x[

Camera on design view does not show the correct position in Unity

I have a character and I attached a camera to him, I want a top view so I have 90 angles rotation on x.
In my game view everything is correct, the character is on the center.
but in my design view the character is on the left right corner,
I cannot understand why this is happening. Any idea?
Probably your Game View is exactly the same as Scene View in the very first frame but you can't see it because it changes in the next Update cycles.
That behavior can only happen when you have one or more scripts changing your camera's transform properties such as position or rotation.
Look into your active game objects scripts (including the camera object itself). Somewhere you are changing its properties.
I hope this is enough to help you solve this problem. I would need to look into your project scripts to identify where is the problem and probably I wouldn't want to because depending on your project size it might take a lot of time :)