How to add torque in a specific direction

Hi everyone! I am fairly new to UE and coding in general and I’ve run into something I can’t seem to figure out. I am using blueprints. So, I have a ball which I am moving using torque. (Specifically, the Add Torque in Radians node). I have set up a third person camera which can rotate around the player. The issue is that the torque is being added relative to world coordinates. Because of this, when I am looking at the face of the player, I am still moving forward relative to the world. I would like to figure out how to add torque to the x and y coordinates which are relative to the direction which the player is facing. How should I approach this using blueprints?
Any help would be appreciated!

1 Like

Hey @Fafarlando, welcome to the forums!
So from what I’ve understood from the question, it seems like you want to move forward in the direction the camera is facing, right? I think the best way to achieve this in blueprints is by using the node Get Camera Rotation, and I believe the initial target is the player camera. Then I would add the torque to the ball based on the camera’s rotation.
I hope this can help you out, and let me know if you need more help!
-Zen

1 Like

Thank you!
So the issue is with the torque being applied in a linear way if that makes sense. My mesh is a head and it keeps rotating, however the force does not take into account the x y z coordinates of the component. That’s what’s confusing me. I’ll send screenshots of the way the BP’s are set up.

I would like to figure out how to add torque to the x and y coordinates which are relative to the direction which the player is facing.

To roll in the head’s forward direction with torque, you’d use its Right Vector. Some examples here:

I have set up a third person camera which can rotate around the player.

If you want to roll the ball head in the camera’s direction, use the camera’s Right vector (or its springarm’s - depends on how you set it up). Namely:

5 Likes

Thank you very much!

1 Like