I am trying to create a camera which:
Will always be looking at the player (using a RInterp node with customizable interpolation speed) and…
Will locate itself at one of several possible locations in space (a vector chosen among several vectors which are stored in an array) according to which point is closest to the player pawn. I want these transitions (between one point and the next or the previous one) to be smooth, so I am using a VInterp node with customizable interpolation speed.
Both the RInterp and the VInterp are controlled by an Event Tick (and a few branches to deal with movement along the array of vectors, but in every frame there always are both a Set World Location and a Set World Rotation occurring for the camera).
-Here is the part of the blueprint in which the RInterp is programmed:
The RInterp works perfectly, rotating to look at the player at a rate according to the Interp speed parameter.
-Here is one of the parts of the blueprint which deal with the VInterp. (there are a few more but they are equivalent).
This fails to work. While the camera rotates over time to “catch” the player pawn, it does not do the same with location; instead, the camera is teleported to the target location, regardless of the Interp Speed that I set (I have tried with a lot of values, ranging from 0.002 to 10).
I am at a loss about how to solve this. Is VInterp working correctly?. I have set breakpoints and watches and I have checked that the logic is correct as far as I know (checking vector, integer, float values and whatnot). I don’t know why does RInterp do exactly as I want it to but VInterp just teleports the camera, as if I had used just the “Set World Location” node with no interpolation.
I know I could use a “Move Component To” node, but I am interested in VInterp because this is a class blueprint, meant to be generic, and “Move Component To” uses local coordinates.
P.S: I don’t know if this is related, but does someone know how on Earth is this supposed to be possible? (The boolean that rules the branch has a True value at the moment the screenshot captures. I think it might be because all the branches end in a “Set World Rotation” node, but I don’t know…).
Try replacing it with a “TInterp To” node to achieve rotation and location blending simultaneously
Btw, are you using 3D widgets for your camera locations?
Thanks for the help! Don’t know why I didn’t think about TInterp before. Will try tomorrow and get back.
For the camera locations I am using spline points. Get them into a vector array at begin play and go from there.
Okay, I have run several tests regarding my camera and the interps. Here are the results:
-I tried changing the VInterp+RInterp for a TInterp in my camera class blueprint. The same happens as before: the camera interpolates the rotation correctly but teleports to the target location instead of interpolating.
-Then, I tested the TInterp and VInterp on a Capsule Shape. They worked correctly.
-Next, I tested the VInterp on a simple Camera Actor to which I previously set the view of the Player Controller. It interpolated correctly. I assume so does the TInterp.
-Finally, I made a simple class blueprint consisting on:
- A spline (the root)
- A camera set perpendicularly to the spline.
On begin play, I store the first and last point of the spline in vector variables and set the camera location to the first point. When it becomes the view target for the Player Controller, the camera location is supposed to interpolate (controlled by Event Tick) between the first and the last point. And now it teleports again. No interpolation.
I tried changing the class root to the camera instead of the spline, but the teleportation happened all the same.
Then, I changed the camera component for a static mesh (a sphere), and watched it teleport instantly
After creating a class which only consisted on a cylinder, I tried to VInterp it. Watching the “current” and “target” values at runtime I found out that I was wrong, nothing is teleporting, it’s just not moving (the VInterp output pin is equal to the “current” input pin, and it goes slightly up, then back down), and the reason my camera seems to teleport is because the “current” input changes due to the array index which is being called changing. The cylinder VInterped correctly after I set the “Target” value of the VInterp at Begin Play.
Then I returned to the simple class blueprint (camera and spline) which I had created before, and regardless of which variables (“Current” and “Target” pins of the VInterp node) I tried setting at Begin Play and which I set at Event Tick, nothing worked. Besides, in my real camera I cannot set variables at Event Begin Play because I need them to update with camera location. The only variable that is set at Begin Play is the vector array which stores the world locations of the spline points. Getting my “Current” and “Target” values from either the array or from variables updated at Event Tick does not work.