- Home /
Animating an absolute position?
Hey,
I was wandering if it is possible to animate an object to an absolute position?
My current situation is, i have 2 blocks, block one will animate into a blank position in block 2, I do this by taking block ones position, rotation etc and matching this to block 2.
But with us constantly testing / tweaking we are breaking this everytime we change a single position. I would like to animate my block one to go to block 2 position and rotation i set everytime no matter where block 2 is in world space?
Any ideas ?
Thanks
John
Hey mate, Yea thats it. I need to animate it to a position that could change anytime but the position would be relative to another object.
ah, alrighty, you could do it like this, and this is only an idea, i use this type of script if i want to keep my player in 1 spot for a short while until the event is over.
before i post, i'll tell you how it works, and from there i'll see if it's something you might find useful.
you can leave feedback also, how you would have it function in more detail.
how the script works:
when the object the script is on is, Inactive the player will move about anywhere, but when the object is active, the player will snap instantly to the object and be facing which ever direction the object with the snap script is facing, when the event is over, it is deactivated and the player can move around again.
find an empty game object, or just something you want the item to snap to.
add script and either have it programmed via the method you're wanting.
$$anonymous$$e works via the Update() function but is inactive until called.
this script really isn't an animation per say, but you could post variables that could be called via animation. ( comes in handy with certain cases )
Answer by IvovdMarel · Jun 12, 2016 at 09:26 PM
Hi John,
I recommend using a tween engine such as DOTween (my favourite and it's free!) or iTween. Very easy to customize and tweak through code or the inspector.
Your answer
![](https://koobas.hobune.stream/wayback/20220612082619im_/https://answers.unity.com/themes/thub/images/avi.jpg)