P
P
PopTop2021-08-13 13:06:08
Unity
PopTop, 2021-08-13 13:06:08

How to make an animation of the selection of an object relative to the hero?

Hello, I have an object that flies on the stage, I created an animation for the destruction of this object, but when creating an animation in the animation, you need to specify the exact global coordinates, as a result, if I pick up this object in the right place, the StartDestroy and EndDestroy events work fine for me, and if I pick up an object in another place, then the animation naturally plays where I registered. Here's how to make the animation work where I pick it up?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
NoNameDeveloper, 2021-08-13
@NoNameDeveloper

You should never animate an object's position if it needs to be changed from other places.

You have a current object, let's say MyObject . It has scripts, animator, events. You want this object to have different positions, which means that in the animation you should not affect the position of this object.
Therefore, you need to create a child object whose position will be animated.
- MyObject (Scripts, Animator, Events, others) - you specify the position where to create it
- ChildObject - the position of the current one changes through the animator
Thus, the ChildObject will be animated relative to MyObject .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question