What's the strategy to have an avatar sit in a chair that may have been moved?

I’m fairly new. I can make a sit-animation in Blender with absolute coordinates, or one with a known offset relative to the avatar, and move those to Unity, but I can’t figure out how I should make the avatar sit in a chair when I don’t know the chair’s position until run-time, as it may have been moved.

Do I simply animate the avatar to sit, say, a meter in front of where it is now, and then add another transform to move that sitting avatar to the chair, or the reverse order, or somehow blend a known animation with a computed translation and rotation, or is there some better way to get the equivalent of a pose-ball in Second Life (i.e., sit over THERE) and ray-cast / click on the chair?

Or do I invoke the “sit” animation, which I’ve created in blender to occur at (0,0,0), and also parent the avatar to a pose-ball (or empty object) which has an orientation and position and the chair as a parent, then LERP / translate the local coordinates and rotation of the chair over to 0,0,0 and zero-rotation (with respect to its parent) ?

I just couldn’t find an example of this, sorry.

Thank you!

Well, parenting to a game object (aka pose ball) then setting local rotation and position to zero works, and parenting the ball to a chairl lets the pose be adjustable so that works too.

There are large number of post and tutorials on how to launch a “sit” animation, and how to make one, but they all seemed to assume it was obvious to everyone how to connect the sitting to a particular gameObject that was somewhere else, or a vehicle (as most of the car race games don’t actually have the avatar sit in the car.)

I’d still appreciate anyone who points out to me there’s a better way to do this. Thank you!:smile:

1 Like

Try Target Matching. Even if you don’t use Mecanim’s target matching, you can use the principles behind it.

Also see page 24 of Naughty Dog’s writeup of their character animation in Uncharted:

http://www.naughtydog.com/docs/Naughty-Dog-GDC08-Creating-a-Character-in-Drakes-Fortune.pdf

They use transforms that they call “locators” to get their characters into a target position to perform certain animations, even to synchronize two characters together such as hugging or shaking hands.

1 Like

TonyLi, thank you, those are both eye-opening and very helpful links! What a great slide show!

Glad to help! The folks at Naughty Dog are really generous for sharing so much of this kind of information. One of them, Jason Gregory, wrote a great book called Game Engine Architecture. (I have no relation to it other than thinking it’s an excellent resource for game developers.)