where ‘UnitDirection’ is the unit vector of my rotation obtained by
rotation.vector()
It works well with increasing yaw rotations, but it always gave the same value to the unit vectors with increasing roll rotations. As a result, the line trace comes into a line like this:
rotation.vector() gives you a vector facing in the direction of the rotator. Roll does not change direction, but orientation.
I believe what you are trying to achieve here, is rotate your angled vector around the world Z axis (which is what you achieve by incrementing Yaw), then rotate it around world X axis. Instead of converting rotator to vector, use a rotator to rotate your initial vector around the desired axis. There is a blueprint node to construct rotator from axis and angle.
Thank you for your reply. After checking the source code, I finally found that rotation.vector() is in 2D space but not in 3D space, hence it is not affected by roll value. I can’t believe I have misunderstood it for such so long.
BTW. What’s the fast way to get the vectors with increasing roll, zero yaw, fix pitch to a vertical plane (Normal vector is already known)? This is what I actually want to achieve.
Get my angled vectors first and then use dot product and their magnitude to the normal vector?
All your vectors have the same angle (dot) compared to the axis you rotate them around (in this case, 30° because pitch=30). Multiply them by a fixed distance and they’ll all be on a plane.
Base on your advice, what I need to do is get the unit vector (normalizes it) first and then get the fixed distance (by arcos30 with the normal). After that, multiply them together, am I correct?
Vector converted from rotation is already unit. Just multiply by an arbitrary distance (eg. 10000) and all your points will form a circle on a plane at 10000 distance.