Make entity in the camera move slower than camera

How would I make it so it looks like the light in my camera moves slower than the camera then eventually catches up with it?

Hi @Mason_Rocchio,

You could use lerp in a positon Vec3 to get it to slowly catch up to the target position:

https://developer.playcanvas.com/api/pc.Vec3.html#lerp

You can check the model viewer template, the orbit camera script does something to add intertia to the main camera. So when you move it around it feels “heavy”, there is a delay to follow your rotation.

Would I copy this into my light entity?

var a = new pc.Vec3(0, 0, 0);
var b = new pc.Vec3(10, 10, 10);
var r = new pc.Vec3();

r.lerp(a, b, 0);   // r is equal to a
r.lerp(a, b, 0.5); // r is 5, 5, 5
r.lerp(a, b, 1);   // r is equal to b