# How to make Vector3 from x,y,z rotations?

I have a marble sitting on a plane. Originally I would rotate the plane on it’s x and z axis causing the marble to roll around - a simple version of labyrinth.

I was thinking instead of rotating the plane, obstacles, camera, lights and everything else I should instead just alter the gravity vector.

So my question is, How can I create a vector based on rotations? I’m trying to write a function where I’d input x,y,z axis rotations and it would return the proper vector. So when the plane is level i would want a gravity vector like:

``````Vector3(0,-1,0)
``````

And if I altered gravity as if the plane were rotated 90 degrees on the z axis I think it would be:

``````Vector3(-1,0,0)
``````

And 45 degrees on the z axis I assume would be:

``````Vector3(-.5,-.5,0)
``````

so if it doesn’t already exist, can someone head me in the right direction for how I would write a function that does something like this:

GetVector3FromRotations(x:Float,y:Float,z:Float)
where x is the rotation around the x axis, y is the rotation around the y axis, and z is the rotation around the z axis.

I am obviously a beginner with the 3d vectors so I really appreciate any help or if someone is able to point me to a good source for understanding this.

``````var rotation : Quaternion = Quaternion.Euler(x,y,z);
var pointer : Vector3 = rotation * Vector3.forward;
``````