# 2D , Make my character walk in a vector3.up , but in a angle.

Hello!
I have searched alot but i haven’t had the luck to find anything.
Soo i want my player to go up in a angle, so atm im using this code.

`````` transform.postion +=  Vector3.up * movSpeed * Time.deltatime;
``````

How can i do so when i click D, he walks in a angle upwards.
Now he just goes straight up.

I have tried this :

``````transform.position += Vector3.up (0,0,317)  * movSpeed * Time.deltatime;
``````

But it don’t work.

Im sorry for my bad english just woke up …

Thanks

When you move something you need the direction of the movement. If you want to move something up and forward the direction is a combination of both the forward and the up direction vectors.

For moving a transform you should rather use translate() than setting the position manually.
Here is a little function in c# that should do what you want:

``````public void MoveAngle(float moveSpeed, float angle)
{
//Limit angle from 0 to 90 degrees
angle = Mathf.Clamp(angle,0,90);
//Get acclimaty in scale from 0 (0 degrees) to 1 (90 degrees)
float acclivity = angle/90;
Vector3 direction = transform.up*acclivity+transform.forward*(1-acclivity);
transform.Translate(direction*moveSpeed*Time.deltaTime);
}
``````

Thanks