Okay, so I was trying to implement a new feature to my game where the enemy would be able to look at the player vertically. It's easy to make the raycast point at the player but, I don't know how to make the enemy look up at the player vertically. I tried exploring a solution that involved inverse kinematics but, all I ended up with this thing that looks freakishly wrong:
So here is what my code looks like for this:
func back_IK():
if state == AIM or state == ALERT or state == FIRE:
spinIK.start()
spinkIKtarget.look_at(player.global_transform.origin,Vector3.UP)
else:
spinIK.stop()
skeletons.clear_bones_global_pose_override()
I don't know how to fix this problem. I suspect that it has to do with how the local space for the enemy's kinematic body is different from character model's rig:


Still, I just don't know how to fix this. I attempted to add this feature before but, I scrapped it because it was holding me back. However, implementing this feature would allow the enemy to aim at the player vertically without looking silly; it would also give the player the ability to jump around without making the enemy look silly. Does anyone here have any solution to this problem? When I don't run the function, the enemy looks normal again:
Edit: Okay, I'm just going to export it again from blender and then set it up in Godot again. I'll be back to tell you how it's going but, I was hoping there was another solution.
Edit again: Okay, so editing and re-exporting it didn't work.
So I've made slight alterations to the code and now the enemy looks close to be alright for now:
func back_IK():
if state == AIM or state == ALERT or state == FIRE:
spinIK.start()
spinkIKtarget.look_at(Vector3(translation.x,player.translation.y,translation.z),Vector3.UP)
else:
spinIK.stop()
skeletons.clear_bones_global_pose_override()
Now I need to reimplement player jumping to see if it really works.
Edit: Okay, they're problem with that previous code so I'm going back to what was previously established. Still, I managed to find a way to fix the whole problem with the local space. However, I'll have to react the weapon and all that other stuff; brb when it's done.
Edit again: Okay, I found the solution to the problem. All I had to do was "Override Tip Basis."