- Home /
Timeline animations and positioning game objects relative to other objects
This is probably a common enough use case, but I am new to Timeline so here goes. I am implementing a cutscene that is to take place where the action ends. In practice, I want some characters to walk in and grab another character by the hand and walk them out.
Now the problem, obviously, is that the "other character's" initial location depends on the scene and can even vary within a scene (depending on where the character happens to be). How do I position the game objects so that they start from the same offsets relative to the character being dragged out? Now assume that the character doing the "dragging" will also be a Game Object from the scene altho I guess a way around that would be to hide the original and clone it to the correct spot and then animate weight
variable in the IK Rig to do the arm grabbing.
Any idea how to do it? I know I could do this via code and manually just doing the movements, setting animations and so forth, but this seems awfully inconvenient and rigid way to go about. Any help would be greatly appreciated.
Answer by DavidGeoffroy · Jan 04, 2021 at 10:14 PM
You pretty much have the right idea.
Either you clone and hide, or you disable inconvenient scripts and use the existing instances. In either case, it's up to you to figure out what works with your game logic.
You need to animate the "dragger" object with a given rig, and bind the instance you want to use at Runtime through the PlayableDirector.
As for getting it in the right position:
A lot of developers people cheat by using camera cuts
You can use pathfinding and a blend in to get them close enough
But there's no out of the box, one step way of doing this, since what needs to happen depends heavily on how your game logic is setup.
Right, the issue is that this behavior will happen somewhere and it is almost always in a new place - which is why I need to sort of "play the animations on the spot". Ah well, will need to give it some more thought - basically sort of forgot about this.