Need help with lockedTarget camera

Hi everyone,

I built this camera system based on different sources. I need it that way in order to use event.code for keyboard inputs ( which is better for qwerty/azerty uses and also allows me to use click input to control the character in my project).

Twice in my project will I need the user’s control to be disabled, and the camera (which will be animated) to use lockedTarget on a specify mesh.

But as you can see, lockedTarget doesn’t seem to be working in my configuration.

Here is a playground of my problem : https://playground.babylonjs.com/#YQBY3K#1

Any idea on what could be the problem and how to fix it ? Thank you

I am not sure to fully understand what you are trying to achieve ?

Maybe @Evgeni_Popov would have a better idea ???

Sorry, when I said:

“Twice in my project I will need the user’s control to be disabled, and the camera (which will be animated) to use lockedTarget on a specify mesh.”

I mean sort of like cutscenes with the same camera.

I’m not sure that the targetting system works as expected when the camera is parented to another node… Try to unparent the camera (camera.parent = null) when in cutscene mode.

Thank you for your response.
With your solution, the camera can be locked on a target, but when I parent it again after the cutscene, it’s make it hard to sync the camera position and orientation with the parent to avoid a jump.

I think I’d better try to create another fps camera that does not need parent.