- Home /

# Convert angle to Vector?

The problem that I have a player and I need to convert the player's z rotation into a vector2, which will be normalized and then I will multiply the vector by a velocity factor, then I'll apply the vector as a force to the player's Ridigdbody2D.

Essentially I'm not sure how to turn the angle into a vector. I was just going to use some trig functions to get the rise/run, but that wouldn't work for angles greater than 90 degrees.

Anybody have any ideas?

**Answer** by robertbu
·
Dec 26, 2013 at 12:53 AM

Try this:

```
var vForce = Quaternion.AngleAxis(angle, Vector3.forward) * Vector3.right;
```

You likely want to normalize the result before applying the force. This code assumes you are using Vector3.right as your zero angle.

A vector multiplied by a Quaternion returns a vector. The order is important. It must be q * v. The reverse (v * q) is undefined and generates and error.

So multiplying the quaternion.angleAxis by the zero angle vector gives a vector in the direction of the Quaternion.AngleAxis?

What does 'inverse of this' mean? Convert a vector to an angle or rotation? Or??? Consider just opening a new question with a full description of what you are looking for.

**Answer** by iron-monkey
·
Jul 31, 2014 at 04:11 PM

Why not just use your player's up, forward, or right vector?

http://docs.unity3d.com/ScriptReference/Transform-up.html

rigidbody.velocity = transform.up * 10;

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.