Wednesday, October 16, 2019

unity - Manipulating an animation towards a target object (ie. The hand and arm lean towards the target)


I am trying to make a boxing game just for fun (I dont expect the end product to be anything decent lol) . I have my boxers in the ring and they are animated quite well so far, with Idle, and punch Left and Right. They also rotate so they are always looking at each other.


What I want to do is give the punch some aim towards the head. I will give the punch a set amount which it can move from the standard animation and move the hand bone in the direction of the targets head object. But I don't know how to do this :S


So far i have used dragged the 3 animation files into Mecanim and coded it to do the animations when a button is pressed.


Is there a way to manipulate the animation in this way? (ie. actually make the arm reach towards the target object )



Answer



As the comments suggest. The two parts of Unity made for this that I could find are Target Matching https://docs.unity3d.com/560/Documentation/Manual/TargetMatching.html / and Inverse Kinematics https://docs.unity3d.com/560/Documentation/Manual/InverseKinematics.html /// https://www.youtube.com/watch?time_continue=117&v=GYfeALySSq8.


I also found a very basic "fake IK" solution that just uses the spine and was very easy to implement. But this only really works to get a character to point towards the target (eg. Aiming, or just watching it) , i dont think it would be too good for my punch the head target, which im trying now to make by using the other two things. But here is a very easy gun aiming solution for beginners: https://www.youtube.com/watch?v=6UgB7TMk3Bg


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...