I’m making it so when the mario hits a floating block, then block will play a simple animation of going up and back down like it is in real mario.
I’m trying to use the unity’s built in animation editor, but when i make a simple animation for one box which changes it’s position y up and down quickly and then try to apply same anim for other boxes of same type, it transforms those other boxes to a position of the first box where animation was made
What am I doing wrong? Or it will always be like that what ever i try with unity’s built in animation editor?
I tried making same animation with 3dsmax and cinema 4d but when i play the anim inside unity the same block i animated with c4d and max just disappears when animation is played… o.o
It only has like 5 frames, changes position up a little and then back down.
What on earth is the problem?
I don’t have an animation handy right now, but IIRC if you right click on a key in the animation you can select to have it auto smoothed. You can try turning off auto smoothing to avoid the interpolation which causes the jump.
the problem with using the animation editor in this case is that you set the absolute position of the object in the animation editor.
so every object using the same animation will end in the same position because its transform will use those same positions.
you would have to store relative offsets, so what you likely need is a component with a public property Vector3 offset and use that to transform the object relatively
I started another thread today with the same topic, sorry!
So, how could those absolute positions be transformed into relative positions?
I miss some kind of checkbox in the animation component to turn it absolute or relative depending on your needs… Doesn’t it exist?
However, this what the documentation says in “Objects with Multiple Moving Parts”
“Animating Child Game Objects
When you edit Animation Clips with the Animation View, the animation data will always be stored relative to the Game Object with the Animation Component…”
EDIT: Once again, I answer myself. It’s easy if you create a dummy object and place your animated object as its child. Then, effectively, animation data is relative to the parent object.
Just put your block on an empty object and create your animation on the empty object by moving the block’s child’s transform. Then just duplicate this empty object or create a prefab with it and move it wherever you want!