I want to make a cutscene where my first person character pushes a lever, for instance. The obvious problem is that player can walk up to the lever from many possible angles, which necessitates the game to forcibly shift the player into appropriate location before playing out the sequence. The current idea is: player walks up to the object, presses “use” button and then cutscene starts, when he’s smoothly transited to position and location at which the playing animation of pushing the lever would line up with the animation of the lever itself, plays the animations, then transitions player back to his old location and gives control back.
I have sorta vague idea about how to implement first part with transition (Activation of the event locks player out of controls, write current position and orientation of the pawn, timeline lerp that with the position and orientation desired for the animation, play animation, lerp in reverse, release controls back to the player), but two problems arise:
1. That’ll take care of position and the orientation of the pawn, and the softness of the transition, but what about the camera’s pitch? How to overwrite, or limit the player’s camera rotation input? Limiting would be the best, since I then could also lerp limits from their standard values to 0 to lock the camera firmly (It’s parented to the character model’s head bone, so it should let the animation to still move the camera appropriately)… I’m currently limiting them with passing the input through the clamp node, but it adds ugly effect that you can move “out of range” in one direction, clamp helps to restrict the camera movement but doesn’t affect the input values, so the result is that when player starts rotating in opposite direction camera won’t move until the control input is back in the clamped range.
2. How to actually play the animation itself? Pawn model using animation state controller, and I couldn’t find any obvious way to temporally override the state machine with an animation, or another state machine (if I need the cutscene to be wee bit more complex and requiring some amount of player’s response, kinda like in Alien:Isolation). And ideally that transition should be soft as well.