What I needed was a solution to automatically equip the same prefab to any of my 6-8 characters which all look about the same.
I literally put the gun in the hands of the first avatar. Then I recorded the (local, relative to the hand bone) position of the gun and the name of the target bone and made a handy script that can setup the gun at the correct position for any avatar.
I decided to go procedural (read the previous post to understand why) so what I do is override the arm's transform inside LateUpdate. One reason it's so easy (and the result somewhat tolerable) is the simple, cartoony art-style. One advantage: works whether the actor are running or standing idle.
Minimally we need the bone name and want to move this bone towards the shooting target. Initially I used “transform.forward”, however a bone's "forward" vector may be something else.
So much for procedural animation.
No comments:
Post a Comment