I have a pawn with its body(local) XYZ coordinate with origin at (0 0 0) in the world coordinate, the pawn’s Z axis is pointing to an arbitrary ending point, for example (1 2 3 ).
At the same time in the world coordinate, there is a vector AB also originates from (0 0 0) and points to an arbitrary ending point, for example, (9 8 7).
Now I want to make my pawn’s Z axis to align with vector AB (both originate from (0 0 0) and point to the same direction in world coordinate), so that Z axis is overlapping with AB. After this, I want to rotate my pawn around AB (or Z) axis for a certain angle.
May I ask how these can be done in BluePrint or C++ code? Thank you.
Hi man,
i think you can try setting the actor rotation? i am not sure because i rarely use pawn.
By the way there are a lot of nodes in blueprint to manage vectors.
Look at rotation, will give you a rotato, using a starting location vector, and a target.
Thanks for the suggestion. My object is a BluePrint class, with a static mesh added to it, so it is just a movable solid body. I’m looking at different rotations in UE4, like SetWorldRotation. What Idon’t understand is that there are three numbers, R, P and Y (I guess they are roll, pitch and yaw). When I set these three numbers, what exactly happens? Is there a sequence in roll pitch and yaw? Like how Euler angle works?
Also, how the orientation of a movable body’s local coordinate defined with respect to the world coordinate in UE4? Euler angle and/or quaternion?
Thanks for the advice. My object is a BluePrint class, with a static mesh added to it, so it is just a movable solid body, not sure if Look At can be used.
In my level, I have a curved and banked road surface, which is fixed in the world. I wish that whenever I set my solid body on the road surface, the solid body’s Z axis is pointing the same direction of the nominal vector of the road surface, where the solid body is currently located at. I do not use physics in UE4.
I’m looking at different rotations in UE4, like SetWorldRotation. What Idon’t understand is that there are three numbers, R, P and Y (I guess they are roll, pitch and yaw). When I set these three numbers, what exactly happens? Is there a sequence in roll pitch and yaw? Like how Euler angle works?
Also, how the orientation of a movable body’s local coordinate defined with respect to the world coordinate in UE4? Euler angle and/or quaternion?
the rotation is just a vector.
It gives you a dimension because it is at a fixed magnitude of 1.
it’s easier for anything to work off an axis value then it is to always perform trigonometric functions to allow you to place in an angle.
in your case. Marching a “something” to an underling object.
Create a custom event.
plug in. A line trace.
set actor location as start.
Break vector from location.
multiply Z × 8000 or so… make vector with origona x/y+z and use as end point.
On hit - so create a branch with the result.
break hit result (or split pin on trace) and find hit. You have a variety of options including Normal.
but, perhaps more importantly you can get a reference to what was hit.
You can use that to just grab rotation, and plug it directly into the rotation of the object (actor) you are working on.
Don’t forget that you need to call the custom event one way or another.
make it a bluetilitiy and call from editor, or hook up to a construction node.