I got a spring arm with a camera attached at a length (pawn without character). There is an actor located at a world position always closer to the world center (0,0,0) as the camera (Start in pic). Now i would like to rotate the spring arm to have the actor in front of the camera, better saying in the middle of my view (End in pic).
I could not figure out how to calculate the rotation angle to rotate the spring arm to and how to rotate the spring arm over a certain time to accomplish this, any help will be so much appreciated.
The picture shows the top and left view of the scene.
If you have the camera attached by spring arm to an actor at World center,
and you want to line it up with the Pawn,
I think All you have to do is get the LookAt vector from the world centered Actor toward the Pawn, then flip it backwards.
Or maybe subtract the one location from the other. Not sure which one first and which one second in the subtraction operands, or whether you’d need to multiply the vector by -1 or something.
My basic idea is:
world-centered Actor look at the Pawn. That’s the exact angle you need, but going the wrong direction, so just flip it.
OH! And make sure its the world centered actor that you’re rotating, obviously, because that controls where the camera on the spring arm will be located at the end of the arm since its stuck to the rotation of the world-centered actor.
Thank you so much, your idea did worked out.
Woot! Glad to hear that, I was just making stuff up off the top of my head.