I have tried finding tutorials and documentation about how the Rotators and Vectors work in advanced topics, like rotating a vector from axis and from another rotator. The past few days all I have found was not clear enough for Unreal Engine applications, maybe I’ve got more confused than before.
In resume, I want to make a trace generated from a distance vector between two actors rotate for 90 degrees, to the right of the origin trace point.
Simple Line trace: Starting from the actor ending from the resulted vector from the difference between them.
That worked well:
Them, trying to use a RotateVectorAroundAxis function (being honest, did not understand well how this works), got the following results:
Got a result trace from a vector rotated around 45 degrees from the actor location…
In resume: I wanted to know how to use this function(RotateVectorArounAxis) correctly or what’s missing in my blueprints that I did not see.
In addition to my first paragraph: What could you (community) suggest me to start an advanced study about Vectors and Rotators? This surely can help me to solve this problem too.
Thanks in advance
Hey, so I think what might be going on here is that RotateVectorAroundAxis is looking to take a direction vector in for its Axis. Try using GetUpVector to get the vertical axis, then rotating around that. Here’s an example:
In this example I use the character controller from the built in shooter project. We use the camera’s position for the start location of our line trace, then we use the forward vector * some constant to get a distance from the camera. Add that distance to the current location, and you have an end point that will trace from the camera to some distance. If you want a ray that will fire to the right of the camera, we can rotate the direction of the vector first by using RotateVectorAroundAxis. In my example, I pass it in my forward vector, then rotate 90 degrees about my up vector. This will turn the forward vector 90 degrees to the right.
Got this working as I wanted after following your logic.
Do you have any suggestion how can I advance my study in these topics?
Ha! Yesterday I was really wondering why you wanted the vector to go 90°. Now I see
I’m simulating a Centripetal Force for a Circle Strafing Implementation, so it has to move this way: first it traces a target and them impulse forward to the object as it impulses to a right angle from the object referenced.
Those traces are actually just to get the 90 degrees calculation.