[SOLVED] Tweening Player Camera Rotation unpredictable result

So I am finally tackling the gameplay mechanics of Kingpin Lanes (https://playcanvas.com/project/758896/overview/kingpin-lanes) and starting with tweening the camera into a locked position.

I’ve worked out the math for how to tween the player to an exact location (in front of the first opponent character) and assumed the rotation would function the same. The math is correct (as shown in some textboxes I’ve included for testing – the camera needs to end up at -45 Y, as shown) and the camera does move, but it doesn’t move to the correct orientation.

I am assuming this is because the camera is parented under the player element, but I can’t factor how to compensate for it. Any ideas?

A little quick background: I used the Unreal Engine to make 4 iOS mobile games a few years back (here’s the trailer for the last one) and that engine had a neat mechanic for tweening the Player cam to a new, fixed position:

Basically, one just placed a new camera in the desired position and added a simple pre-made script that smoothly transitioned the Player cam to the new cam position, over a specified amount of time.

I used this technique dozens and dozens of times.

Perhaps this could be considered a feature request? In the meantime, I am content to hard-code it, but as I’ve only been learning javascript for a few weeks, any help you all might have in identifying this Player camera rotation issue would be greatly appreciated.

If you are using the tween library, could you use global rotation instead of local? That would mean it doesn’t matter what the parent’s rotation is.

As Yauster said, the tween library should work well for you. More info here:
https://developer.playcanvas.com/en/tutorials/tweening/

Thanks, guys— I got it to work! I honestly don’t know how, but boom. Onto the next step.

1 Like