- Edited
Aim with Stick bone angle
Hi All,
First of all. I am very new to animation and game dev. So, pardon me if this is too basic question.
I have a similar setup as Spine Boy aim. However, in run-time, I want to move crosshair bone with left/right stick in 360degree. It works fine and all bones follow the crosshair. However, spawned projectile when moved always have some angle, even if I put crosshair on top of the character position (keeping stick position in upward direction). I know it's because how bones are aligned and direction that I calculate based on two bones(the spawning point and crosshair). Is there anyway to make sure bones are aligned in straight line other than manually setting up bones such a way in spine?
The problem with manual setup is: The crosshair bone has IK setup on left arm bone where as spawning point is on first finger of palm. I attempted to diagonally align left arm bone with first finger, but character looks weird.
Please, guide me to some direction that I can take to correct it. I am using Unity and bone follower script to move crosshair.
If I understand, the issue is that the angle from the bone where a bullet is spawned to the crosshair bone is not the angle you want a bullet to take? Can you adjust the angle by a fixed amount? Why is the angle wrong?
Here you can imagine a straight line from the muzzle bone to the crosshair: Image removed due to the lack of support for HTTPS. | Show Anyway
However, if you move the bone closer you can see that line comes out at the wrong angle: Image removed due to the lack of support for HTTPS. | Show Anyway
You could spawn the bullet using the muzzle bone position and rotation, rather than using two bones. That ensures bullets are always aligned with the gun, but won't necessarily travel through the crosshair.
To fix that ideally you adjust your IK so the gun points at the crosshair more precisely. For spineboy it seems that a little rotation on the Image removed due to the lack of support for HTTPS. | Show Anywaygun
bone is sufficient.
Hi Nate,
Thanks for your response. Yes, you got my issue perfectly. I had to adjust IK so that gunpoint/firepoint are precisely aligned with crosshair. I also had to adjust my character's pose a bit to make arm straight and no elbow bent. These adjustments solved the problem I was facing and now aiming and firing looks more natural and kind of predictable.
One point though, may be a improvement idea for spine overall. I needed to put a bone in straight line in respect to other bone. This is easy if bones are aligned in 90 degree. But, if bone is rotated and following some angle, putting another bone in the same line somewhere else is tricky. What I had done, is use scale tool and scale the first bone to see if it correctly, scales upto the second bone in same angle. If there is some tool in spine which can kind of draws a line along the bone, it will help a lot. I also tried to use ruler, but it didn't really help.
Thanks for your time and help.
You can do it by parenting the crosshair bone to the muzzle bone, then set the translation to x, 0
where x
is how far away you want the crosshair bone, then parent the crosshair bone back to where you actually want it.