How can I update a rotation to point towards a touch input?

Hello, I am struggling to do this correctly. I have a 2d sidescroller and I want an object to rotate on one axis (normal to the mobile device screen) and point towards the touch input. Can someone help me with the logic required? I have the variables for the axis origin and i am correctly updating the variable for the location of the touch input, I just don’t know the necessary scripting to tell the axis to rotate towards the touch input location around the axis origin. Is there a way to rotate something towards a vector2d because I am getting the correct vector2d from the axis origin to the touch input, I am just not sure how to correctly update the delta rotation on the component to point in the direction of the vector2d. Screenshot attached. Thanks for any help!


Hey ahopps01,

If you are already successfully getting the touch input’s world space location (2D), then you can use a similar solution to what is presented here: How do I setup having a NPC Rotate towards player Character? - Programming & Scripting - Epic Developer Community Forums with the Find Look at Rotation using your arrow’s location and the touch location.

Hope that helps out!


HI Steve

How we can get the touch input’s world space location (2D) inside bluprint and not Level bluprint.