- Home /
How to make ik punch animation to target a position (enemy head)
I'm trying to figure out how to achieve this? Trying to make a boxing game, at first I only wanted to use basic animation, and just detect if the enemy is punchable, but know I puzzled on how to make the character try to punch the enemy head for real.
Any ideas?
Answer by Eno-Khaon · Jun 02, 2020 at 06:32 AM
Well, if you take the standard usage of Inverse Kinematics at face value, then you're just modifying the target position to aim the boxer's fist at.
With that in mind, it can be handled in (at least) two general ways:
1) If you already have an animation, blend that animation with the IK target on the fist. It may take a bit of tweaking to get the punch to throw in a straight line, but it would otherwise look more natural than the alternative...
2) Manually animate the punch by interpolating the fist's target position between where it started and slightly beyond the target point on the opponent. It will very potentially/likely look less realistic, due to the programmatic nature of it, but can easily draw a perfectly straight line for the punch.
// To accommodate body movement during the punch, use something like...
Vector3 initialFistPos = playerTransform.TransformPoint(initialFistPosLocal);
// A simple approximation of the motion itself
fistCurrentPos = Vector3.LerpUnclamped(initialFistPos, opponentFacePos, 0.0f to about 1.2f);
Answer by lisajordan · Jun 02, 2020 at 11:58 AM
Apparently I do not see any kind of code or script error to get involved with that but yet it is to be addressed that why it halts with few seconds of it's execution. As a software developer from https://www.nursingessays.co.uk/dissertation-writing it is advised from many expert to get assisted from community in case of this troublesome situation
Answer by Amya12 · Apr 06 at 03:57 AM
Thanks for sharing this article. [url=https://twindkf.com/]OmaarKing[/url] ,Thanks for sharing this wonderful post.