I’m hoping to query the Animator object to find the animated object’s position at a future time.
My use case: I have two cameras in my scene. One is a freely movable camera controlled by the player, and one is on an animated path doing a flythrough of the scene. At any point during the flythrough, the player can break away from the animation and move freely to explore a specific part of the scene more closely. Then by pushing a button, they transition back into the flythrough.
My problem: The flythrough camera must keep tracing its animated path as the user freely explores (i.e. it does not pause when the user breaks away to explore). I want to animate the transition from the freely movable camera to the flythrough, basically by Lerping over X seconds. This means I need to query the animated camera to find out its position X seconds in the future, and Lerp to there.
With the old Animation object, you could accomplish something similar by simply setting the time attribute of the animation. Is there some way to do this with the current Animator object? I’ve looked for a while, to no avail. Any help is appreciated!
Hey henry - since you said any help Ill give a suggestion.
Not a coder so Ill be using simple logic. 
Since the fly through camera is on a path I think a simple solution could be to place a game object as the parent of the camera and animate the game object along the path with the fly through camera parented to it.
Then at any time the player can deviate the camera away from the set path and look around, as already designed, but the difference here is it is the same camera, not a different one. Just decouple the camera from the fly through game object. The game object continues down the path as desired.
When the action is done to return to the fly through Im sure there is a code process to re-align and reparent he camera back to the game object - and the camera will continue to follow the path as desired.
Thanks for the input!
Interesting – so maybe using the Animator object as is, there’s a way to animate the camera from its current position to the position of the original parent, which is still following the original animated path. That way no prediction of future position is needed. Good idea, and will try it out.
1 Like