I am trying to combine IK with virtual bones to create a procedural aiming system. I can’t figure out what I am doing wrong, so here is where I’m at:
I’m drawing debug spheres where my transforms and virtual bones are being transformed. I’m using two virtual bones attached to the head like so:
- VB Sight is the parent bone that I want to align with the camera. It tracks the hand_r bone.
- VB Sight_Hand_r is a child bone that gets copied to the right hand bone. It also tracks the hand_r bone.
I then want to move the parent VB Sight bone where so that the VB Sight_Hand_r bone follows. I’ll then use IK for the rest.
The initial setup part is working correctly. All transforms are in World space. The Transform (modify) Bone node is in Bone space and the Copy Bone node is in Component space.
This first section results in the correct location of my debug spheres. The YELLOW sphere is the world transform of the socket on my weapon that I want to move in front of the camera. The CYAN sphere is the VB Sight_Hand_r virtual bone. The BLUE sphere is the VB Sight virtual bone. The WHITE sphere is the camera world transform. So far so good.
I then calculate the relative offset between the sight socket (yellow) and the camera (white). I want to use this to move the VB Sight virtual bone in the same direction to line up the sight with the camera and then apply IK to the right hand. The VB Sight_Hand_r bone should follow since it is a child virtual bone. I do this using this:
In this screenshot, I have my Transform (modify) Bone set to use Bone space, but I have tried them all. Here is the result:
No matter what I have tried, I can’t get the virtual bones to line up where I want them. I’ve also tried parenting the VBs to the root, but get the same(ish) results. I feel the head is the best place since I’m working on a true first person shooter and the head/camera move with offsets.
I’ve run out of things to try. Anyone have ideas?