Hey all, I have a Pawn that contains a physics object. I have my camera set up on a spring arm behind my Pawn and I’m trying to get the camera to rotate in the x and y direction based on which direction my physics object is moving.
As an example: I have a marble on a racetrack. The marble has a camera placed behind it on a spring arm. As the marble moves along the racetrack, it might turn left . As it turns left I would like the camera to rotate so that we still see the racetrack ahead. Currently, when the marble turns, the camera just stays in it’s original position and all I see is the wall of the racetrack.
I believe I need to add rotation to the spring arm that is somehow “linked” to the forward vector of the marble? I just don’t know if this is the best method and how to go about doing this. Any help would be great! Thank you!
PS. “Use pawn rotation” doesn’t work because the marble is a physics object and is spinning in all directions constantly. I just want the camera to rotate based on the marbles vector movement on x and y axis.
Thank you, do you have any documentation on how to obtain the vector of the previous location? I understand what needs to be done afterwards but I don’t understand how to retain the previous vector’s location for use with the “get unit direction vector” node.
You can create a variable, do the operation and then assign it the current location.
By doing the operation before assigning the value, for next frame it will do the operation with the value you assigned the previous frame, then update it for next frame, etc…
It needs to be a child for it to move with the sphere. The alternative is to set the rotation and location on every frame. I added the arrow just to debug if the math worked. You can add how ever it works for you and delete it later.
For anyone looking into this in the future, this is my setup that I got to work based off of pezzott1’s graph but tweaked a little and with no unknown variables. The FInterps are optional but help the camera feel a bit.