In my project, I need to interact with my giraffe, generally speaking, the head of the giraffe should always look at my mouse cursor.
Now I have made an AimOffset with different aim poses, and when I move my mouse cursor around, the head can follow it just like it is looking left, right, up and down, but it is not accurately look at the cursor.
Is there any way I can make it work?
Not sure what you want to do. You could use the function ‘get player controller ->convert mouse location to world space’ if you want the location and direction of the cursor, or you could use ‘get hit result under cursor’ if yoou want it projected on your environment.
For the aimOffset you take the location of the cursor, you substract it the location vector of your giraffe’s head, from this vector you make a ‘rotator from x’, then you make a delta rotator with your giraffe’s head rotation, from the delta, the z value is the ‘up down’ for your aimOffset and the y value is the ‘right left’ component
Thank you very much! But there is no “set bone rotation” or “set socket rotation” function in UE4 blueprint, how can I update the rotation value of the head without changing his body’s rotation?
If you have an aim offset i suppose you have an animation blueprint for your giraffe ? In the event graph you compute the values for your aim offset, then in the anim graph you actualise your aim offset blended with whatever animation you want.
I tried it, but it seems that there are something wrong with my coordinate calculating or other problems, I will try to fix it. Thanks for your help!