'How to make a sprite and hitbox stretch

I am working on a simple 2D game in Unity where two dragons fight eachother. Each player controlls a head that can move up and down the left or right side of the screen (depending on which dragon you're playing) and an attack where the head lunges forward and bites the oponents neck! What I basically want to do is have the head and the body as "solid" objects" and the neck between them stretches or gets compacted as the head moves up, down or attacks. Any suggestions on how to do this?



Solution 1:[1]

You can rig the sprites and use animations to stretch the sprites' meshes as needed.

With the same rig setup you can use inverse kinematics: make the base of the neck stay still and have the top of the neck follow the head. The middle should stretch automatically. This is a bit more complicated but it is helpful if you don't want to animate everything by hand.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lae