Using tween library

that is actually pretty cool :ok_hand:

What do you mean? :slight_smile:
still tweaking lots of stuffs but need my player to rotate smoothly though

Probably that’s a variable that’s used in another game or example, but not in your project. In your project it didn’t exist and that’s why it gives the error of ‘undefined’.

Yeah that makes sense, gotta be more careful next time, although that smooth rotation is not working at all, got no error but neither got my function working :smiley:

So what is happening?

no clue, i would rather use math lerp it is also easier to understand, now i have no idea idea what is happening inside

What is happening outside?

He is not rotating towards points i defined.

if i use simple lookat it is rotating good, but with no smoothnes.

image

Why do you call lookAt() in 2 different methods in the same update loop?

i turned off lookat in followpath when i was testing lookat in smoothLookat

either way lookat works only in followpath

Where is the tween?

if you mean tween.js then it is in my script folder in project

You realise you are calling smoothLookAt() every frame?

Please read the manual.

Calling a smooth rotation tween every frame is not what you want. You should call the tween once when the event happens :slight_smile:

You are right ^^

Something is happening now, but it is not really what i want :slight_smile:

it is behaving really awful

image

1 Like

To be honest, I never managed to get smooth rotation with tweening. I therefore use a different method.

Might be a slightly different use-case but this works butter smooth for my camera rotation:

var exitDurationSeconds = 7.0;
this.tweenRotation = this.mainCamera.tween(this.originEntity.getLocalEulerAngles()).rotate(this.targetEntity.getLocalEulerAngles(), exitDurationSeconds, pc.Linear);
this.tweenRotation.start();

I think its not time for me to use tween library yet

Reffering to other topic: Smooth lookAt function

this one can be locked