Rigging or Scripting – that is here the question.

My character is holding a flashlight.

My character is holding a flashlight. But I also have two animations in the animation controller running. One for the idle animation or walking in one layer, and one for the hand actions in another layer, seperated by a layer mask.

That is the ingame first persion view. As you can see the flashlight is not following the head movment.

What do I do now ? I want the flashlight and the arm following the head movement, so that the flashlight is pointing to where the player is looking.

There are two ways I can do that now : 1 ) I can make the flashlight and the arm following the player view by rotating the upper arm bone. Since there are animations running in the animator, I have to do manual armature bone changes in the LateUpdate method. Only then I can overwrite the ongoing animations. (What was strange there is that even if I use a non-looping one key animation in the arm layer, the animation is always set back to that one-key.)

It is a bit tedious cause I have to do a second mechanism which translates the head movement to the correct arm bone rotation and I have to store the last arm rotation every time. Easy, but unelegant.

2) I could use the new rigging packet by Unity and try to implement a custom rig that implements the pointing via constrains. I did not do that before, only played around with it. But I think it would be worth a try.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.