Pivot for an animation in Unity3D (4.3) - animation

What I want to do:
When a unit lands after falling I want to give it a slight animation of being "squeezed" to the ground and then going back to normal. (Say a slime blob falls and lands, it would get squeezed a little)
Using Pivot "Top Left" on all my sprites the issue that when I scale the sprite in the animation it doesn't scale to the bottom but to the top. My current temporary workaorund is also translating the sprite downwards to counteract that and make it look slike the sprite is being squeezed to the floor. However, there should be some better solution that works with multiple spritesizes and so on.
One thing would be changing the pivot point for just this animation, or maybe a movement thats percentual since the scaling is too. How would I do these though?

Related

Fluid is not touching container

I'm trying to create a fluid simulation on blender 2.92 but after the bake of the fluid, this one is not laying on the floor. It's floating at around 10cm above and also, it stays at 10cm from the walls.
Space between fluid and floor
Space between fluid and walls
Low res render
Does anybody know what I'm setting wrong ? The obstacle is inside a cube which has a solidify modifier applied and set up as Effector / Collision.
Any help will be appreciated
Did
Without having much to look at other than what you had provided, it's the resolution of your domain. When you look at your domain box, there should be a small "cube" in the corner. If you move the cube down under your floor to where the top of the cube is touching the floor, this will fix the gap between the floor and water. Just keep in mind, when you increase that resolution, that cube will get smaller. Meaning, you will need to adjust the position of it yet again. For the walls, you will need to widen your domain until the side of the cube is on the outside of the wall.
Think of the cube as a "safety boundary/perimeter" or something like that. Hopefully that all makes sense?

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.

How to change rigs spine rotation in unity3d, using camera rotation?

I have a rigged 3d model of a person with animations that i made. It is a player model in a first person shooter. I want this model to "bow", when looking down or do the opposite, when looking up. To achieve this, i decided, instead of making an animation for each degree the player might decide looking at, to rotate models spine, depending on the angle of the camera. In scene view, i can easily change rotation value and get the results i want, however, when game is running, those parameters seem to be "locked" and no matter what script i tried, i cant seem to change the rotation value. I figured, perhaps, when animation is playing, i cant change things it effects, so made a body mask to excluded torso from animations and spines rotation was still locked away from me. Is there a way to rotate models spine, when its doing its normal, lets say, idle, animation? is there actually another easy way to achieve this?
You have to update in LateUpdate(). Unity's animator does it's changes to the transform in Update(). By doing it in LateUpdate() it will be handled after the animation has made it's changes.

How do I keep an object always perfectly touching the boundaries of an orbiting camera?

I'm animating a pair of dentures in Blender, where I'm having the camera move around them, and doing the tedious and imperfect work of setting many keyframes to keep the dentures perfectly filling up the view at all times (always touching the horizontal or vertical boundaries). Is there a better way?

How do I animate clouds?

I have 3 nice and puffy clouds I made in Photoshop, all the same size, now I would like to animate them so they appear like they were moving in the background. I want this animation to be the base background in all my scenes (menu,settings, score, game).
I'm using cocos2d, I have setup the menus and the buttons so the work but how do I accomplish this?
I was thinking to add this as a layer, any other suggestions?
Can anyone show me how some code how to make this please?
David H
A simple way to do it is with sine and cosine. Have slighly different parameters (period and amplitude) to ensure that the user doesn't realise (as easily) that they are programmatically animated.
You may also want to play with animating the opacity value. I'm not sure if layers have those, otherwise you'll have to add the clouds to separate nodes or images and applying it to them.
It's hard to be more specific without knowing what the images look like.
The simplest way to animate anything is to add the sprite to the scene, set the position and call something like...
[myClouds runAction:[CCMoveBy actionWithDuration:10 position:CGPointMake(200, 0)]];
This will slide the sprite 200px to the right over 10 seconds. As Srekel suggested, you can play around with some trig functions to get a more natural feel and motion paths, but you'll have to schedule a selector and iteratively reposition the elements.
The more difficult part of your questions is about getting the animation in the background of all scenes. Keep in mind that when you switch scenes, you're unloading one node hierarchy and loading a new one. The background cannot be shared. You CAN, however, duplicate the sprites and animation in all scenes, but when you transition between them there will be a jump.

Resources