how can i get rotation between two vectors using only two axis?

I have a vector 0,0,0 - and another that is the character capsule’s location. I need to point the character capsule’s upVector directly at 0,0,0. LookAtRotation seems to use all three axis to get the character capsules facing (forwarvector) lined up. However, I need the upvector to line up. Additionally is there a way to do this using only Pitch and Roll?

I find myself searching for questions around a key concept in my game and I’m very close to having a workable solution. I’ve gone in and programmed since tweaks to the gravity, and velocity usages in the character movement component and the tweaks are working but I need my control rotation to update so I can use the capsules up, forward, right vectors. So In short , bump. Please help :slight_smile:

Hi Thumper,

you could do something like this:

Calculate the difference vector between the actor and (0,0,0) and normalize it.
Then you use the ‘Make Rot from XZ’ node and put your normalized vector into the ‘Z’ pin.
The forward vector of your Actor rotation goes into the ‘X’ pin.
The output rotation should be the rotation you are looking for.

If you are only interested in Pitch and Roll, you could break the rotation to do some finetuning or whatever you want.

Hi, Thanks for the help. I tried what you said - at least I think I’m understanding the use of these nodes more now. Unfortunately the method you explained produces the results on the bottom of the attached image. I tried it first without multiplying the Vector * -1 but both ways point the capsule upvector in wrong directions. This got me thinking and I tried the way at the top. This is very close but produces odd behavior. The trouble I’m running into now is that because the this is updated every frame somehow, this rotation slightly skews the characters forward vector. So when I run forward it’s actually slightly to the left, just a hair. So I would eventually run in a circle ( a very large circle). The other problem I’m having is I can’t get any influence from the mouse in. Basically doing this rotation locks me out from adding in additional rotation - Like from the Mouse Turn Input Axis, Ideally this would allow me to influence the “Yaw” of the character.

Actually using the node “Make Rot from ZX” did exactly what I was looking for. Now how would I add influence into this? The way I think of this it should leave the characters “Yaw” Axis free to add mouse turn input axis value in. Anyhow, thanks for the help.