Quaternion.Euler problem

Hi I’m working on something that’s placing waypoints but I have a issue with using Quaternion.Euler. I’m setting positions of way points and using the direction from the first point then rotating them after.

I set the inital direction as forward since that’s the direction I want to create the way points in

 nextDirection = Vector3.forward;

Which returns 0,0,1

Then I use Quaternion.Euler to get a rotation,

 nextDirection = Quaternion.Euler(50, 0, 0) * nextDirection ;

Then I get the value (0, -0.8, 0.6) and getting a value on the Y axis instead of the X axis, I’m just wondering if I’m doing in wrong? When I switch the x and y values it works correct but it shouldn’t be the case.

nextDirection is a vector 3, and Quaternion.Euler return a quaternion so you want get what you expect if you multiply them.

what are you trying to do?

I’m confused as to why you are mixing quaternions and vector3. Perhaps what you’re after is more like this?

Quaternion prev = Quaternion.Euler(Vector3.forward);
Quaternion next = Quaternion.Euler(50.0f, 0.0f, 0.0f) * prev;
prev = next;

I’m just trying to add the next way point at a 50.degree angle based on the previous waypoint here’s my code

This is just where I add the first control point and note the direction I want to spawn them in

nextDirection = Vector3.forward; // direction I want to create way points in
AddControlPoint(Vector3.zero); // my method for adding control points
Vector3 lastpos = ControlPoints[ControlPoints.Count - 1].localPosition;
nextDirection = Quaternion.Euler(50, 0, 0) * nextDirection;
new Vector3 nextPos = lastpos + nextDirection * controlPointDistance;// controlPointDistance is used for the distance between control points

I’m also trying to place the control points in position based on the rotation , I’m not that great at using Quaternion :sweat_smile: