Tween rotation restart to (0,0,0) every time

I have an array of Vec3, and I need to use Tween for rotation.
Every time my animation is completed, my object just restart to (0,0,0) and start rotating to a new value
how can I avoid this, so it just continues to a new value?

This is my solution so far, but for some reason after every stage, I get 10 frames of freeze, probably because of lerp

What are you trying to achieve with lerping inside your tween update method?

Usually you would use either one of the two, but not together.

Perhaps that’s due to the delay you are using in the tween?

And for the other part, maybe try saving your starting rotation into a local variable before starting the tween.
For example:
// insert this before the tween
var startingRotation = this.entity.getLocalEulerAngles().clone();

// instead of the current lerp in the update

value.lerp(startingRotation, rotations[counter], pos);

@Leonidas I have an array of Vec3.
I need to animate from the value of the current index to the next one.
The problem is, after every animation, tween doesn’t continue from current rotation, it just restarts from (0,0,0)

With Lerp method it’s working, but not quite right, I found out that on 80% of Lerp function, my local rotation is already value of my next one

I need to use only Tween, but it’s not working with tween alone, because, with every function call, animations always start with (0,0,0)
So if i have array [(20,20,20),(40,40,40)]
Tween will go from (0,0,0) to (20,20,20) ,but next pass will not continiu from (20,20,20) , it will start from zero

Again, i think you problem here is that you don’t lerp correctly. For the lerp you need a fixed start and target value.
However you are not using a fixed start value to interpolate from, since you call this.entity.getLocalEulerAngles() in each update. As i mentioned in my previous comment you’d need to save the starting rotation to a variable and use that one for the lerp. That should fix your problem.

1 Like