Hi,
I’m trying to get an object animated by its local position. I’m tring to increase the position.x value +2 everytime Input Fire1 is triggered.
So far I’m not basing it on physics.
I’m trying to simulate a queue, every time I press fire, all the elements are animated 2 units forward, the first one goes away and a new one enters in action.
So what I do is to animate all of them at the same time 2 units.
The approach I’m using is:
Parent Object ( Animator on that one )
|_ Child (Sprite on that one)
I’m setting 2 keyframes, one at the begining and one at the end. The end comes with position.x 0 2
I have two states, idle and movement. Movement contains the animation and its trigger to get in and out by a boolean parameter.
The boolean is set to true on fire1, and to false at the end of the animation by event.
The animation is not set to Loop.
The problem comes when I want to change the value of parent. I added an event to the last keyframe to trigger a function to reset the position of the child and set the new position of the parent. This works fine but I see a ugly jump in the position of the child.
This makes sense as:
1 everyone is in 0.0.0 2
child goes 2.0.0
3 event is trigger 4
change position of parent (now the child goes 2 units forward)
5` change the position of the child (it comes back two units) (even if I dont trigger this change the same happens).
I tries many things, but I cannot get rip of this ugly effect.
Any ideas?? I’d really like to make it work.
I didn’t make it move by physics because of smoothness and problems since im clicking just once…
Any help please.??