Rotate TPS weapon towards crosshair
Hi good people of the UE4-community. What I want to do is aim my weapon towards the crosshair (center of screen) but I'm not sure how to best solve it. I've tried lots of different things without getting a good result. Preferably the whole upper body would rotate so that the trace from the weapon aligns with the trace from the camera. But just rotating the weapon and hands or arms would be good enough I suppose.
asked Apr 04 '19 at 08:41 AM in Blueprint Scripting
UPDATE: This is how I'm currently doing this. It is by no means perfect but yields the result I'm after. https://prnt.sc/n9pd71 - Here I'm getting the center of where my camera is looking. https://prnt.sc/n9pe5q - I couldn't think of another way of getting a location between the character's eye and where I want him to aim than by doing this. https://prnt.sc/n9peh3 - I set the location for the right hand bone. Since I want to have the pistol_IK bone positioned at this location, I move my hand bone relative to the pistol_IK bone. https://prnt.sc/n9pemx - Here I get the rotation to the crosshair location for the weapon. https://prnt.sc/n9pf07 - And finally the AnimBP where I move my hand_r, rotate the hand_r (adding pitch so the rotation moves with my AimOffset) and move my hand_l along with my hand_r and also look at where I'm aiming with the head.
When trying to solve this I'm mostly just doing it intuitively by trial and error without really knowing what I'm actually doing, so I don't understand everything perfectly. So I'm probably doing it way harder for myself than I need to. I'm sad to see there are no tutorials or no one talking about this out there, what I can find. I'm going to try to make it work better but this is what I have for now.
answered Apr 09 '19 at 06:34 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here