add force on an object to a certain direction

In my game, I have a winddirection, which is a number in degrees and is a variable.
If my player is in the air, it has to drift to that direction (with addForce).

How do I implement this direction in the addForce function?

Thank you for your help.

Since force is a vector, you need to convert your angle into a Quaternion to represent rotation, then use that to rotate a forward Vector3 so it points toward the angle.

The rotation transform happens by using the Quaternion * Operator.

Quaternion rotation = Quaternion.Euler(xAngle, yAngle, zAngle);
Vector3 direction = rotation * Vector3.forward;

The direction vector should now point toward angle. I haven’t tested this, so it may require some tweaking, but this is the basic idea for converting an angle to a vector. Your best bet is to do this math only as the wind direction changes, and then use the vector for everything related to it.

This worked for me like a charm! I needed to offset an object trajectory to only take the y coords from the main camera. I heart the you from 9 years ago, Dave.