Here’s the goal:
Player in first person game clicks on point of interest. The camera swings to face that point (as in, say, a LookAt() or a Quaternion.Lerp()) and in the meantime the player can’t move the camera using the mouse. After the event happens, the camera should remain in that exact orientation when the player regains control of the mouse (after, say, an event, minigame, or cutscene occurs), and smoothly continues playing the game.
I have most of this. I’m using the default FPSInputController. I click on an object (raycasting to find it, grabbing its position, using that to inform a Quaternion LERP over time, etc.), the camera smoothly swerves to focus the clicked object in the center of the screen. Stuff happens. The player can’t mouse around while the stuff is happening. All that works fine. Then I give control back, and the problems are such:
*Moving the camera explicitly this way doesn’t reorient the player object, so the camera no longer looks “straight”, leaving the FPSController to move drunkenly sideways or backwards relative to where you’re looking.
*The camera has also been known to “jump” once the player regains control of the camera, the orientation isn’t the same as the point I LERPed to. The motion is smooth except for one jarring frame where clearly the camera is changing between two obviously different quaternions.
In a nutshell, I need a way to reorient the FPS character to be facing where I set the camera orientation in code, without any twitching, and making sure the camera still looks in the proper direction when the player can move again.
I am setting the camera’s orientation outside of the main FPSController scripts (motor, mouselook, etc.) in another script object, which I’m sure is a factor.
I’ve tried a few hacky solutions, which are just close enough to working that the error is infuriating, but some code listing the specific objects to set in the proper order with the right functions would be nice! I’m sure its a matter of hierarchy, any help would be appreciated!