How can I make the timeline length and keyframe values correct so that the lerp will exactly put the First Camera in the exact location of the Target?

I have the below blueprint, and I’m sure about the values that Current and Target variables are having, but my problem is that in the timeline, I noticed that the length of the timeline or the values of the keyframes are important, meaning that if I set them wrong, the First Camera will move somewhere else. I thought the whole point of the timeline was changing the speed of Lerp, but I didn’t know it could change the movements too. So I want the First Person to exactly end in the location of the Target, how can I do that?

Timeline:

That’s how the timeline works already. The issue is elsewhere.

I’m sure about the values that Current and Target variables are having

  • could we still how and when they’re set?
  • do note that the camera operates in space relative to whatever it is attached to; are you sure Target is transformed correctly?

Here is how I set them:

For the Parent Socket of First Camera I have chosen the “FFP” socket. And I use the “RTS Parent Bone Space”, which means I want to get the relative location of the sockets.

The above looks fine. Could you elaborate on:

How are you changing the TL speed - because that’s what you mean, right? We’re not supposed to touch the TL track points as that would affect sampling and interpolation results. Are you loading curves dynamically? Because that’s a thing, too.

Get TimelineSet Play Rate is the way to go. The higher the number, the faster the timeline plays.

  • 0.25 makes the TL goes 4x slower
  • 3.0 makes it play 3x faster

Let me explain it better. The below image that you see is the view of the aim camera that is using the aimSocket as the Parent Socket:

This is what I see as a result of my code when I lerp:

So why is the First Camera not ending with the view of the aim camera? Because I made it reach the location of the aimSocket using Lerp, I don’t understand why the views are different. I thought it was about the length of the timeline or something.

Draw a debug point/sphere at the current/target transform locations to visualise where you’re asking it to move.

What’s the component hierarchy of the actor?

I haven’t done the debug point/shere that you are saying, but this is the Components tab:

image

The parent class is “character” not “actor.”

A character inherits from actor. Looks fine.

Can we double check the sockets then? Is the aim camera offset on the socket? Perhaps derive the transform from the aim camera rather than the socket.

One way or another, I wouldn’t look for an issue in the TL setup - you seem to have it done correctly. Debug the sockets to see where they really are while the TL plays.

The debug spheres are looking like this:

The locations of both cameras are zero:

image

The aimSocket is inside the right hand bone layer:

image

The FFP is inside the head bone layer:

image

They take world space coords, you’re drawing relative.

This is the world space:

Seems ok, right? Does it? Hard to judge from my points of view. Do those points move when the timeline pans the camera?

Well, changing relative to the world isn’t going to let me observe how they are moving. Because the view goes under ground.
I moved the character a bit back, and then I noticed the debug spheres never move toward each other; they don’t have any movement.

Here is what I was able to do to see how the sockets move. I didn’t touch the Current and Target as they are the positions of the sockets, but I created two spheres and made the FFP the parent socket of the black-red sphere and the aimSocket the parent socket of the white sphere. Then I replaced the First Camera with the black-red Sphere ( which uses the FFP socket just like First Camera)

What could be the reason that the black-red sphere completely does not overlap with the white sphere?

I see that you’re lerping transforms, how about you lerp location only (at least for now, to get to the bottom of this). Perhaps something is pivoting as the rotation is taking place?

Before using location for lerping, let me show you what it looks like when I set the rotation of the aimSocket to zero. (The rotation of FFP was already zero.)

Now that the rotations of sockets are zero, will it make any difference if I use vectors or locations for lerping?

Here is the location lerping:

It jumps somewhere else.

Finally, I solved my problem. The problem was not about the timeline; it was about me not getting the transform of the sockets relative to the correct thing. I found a node named “Make Relative Transform,” and then I made the transform space of the “aimSocket” to “RTS World” (previously it was set to “RTS Parent Bone Space”) and plugged it to the first input of the “Make Relative Transform,” and I did the same thing to my “FFP” socket and plugged it to the second input of the “Make Relative Transform,” and then I finished setting the “Target” variable, and that was it!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.