var lerpedPosition = new pc.Vec3();
var cameraObject = this.app.root.findByName('Camera');
var playerPosition = this.app.root.findByName('Angle').getPosition();
lerpedPosition.lerp(cameraObject.getLocalPosition().z, playerPosition.z, 5 * dt);
cameraObject.setLocalPosition(lerpedPosition);
if this should work, well it isnt
because last line says setLocalPositions to all three vectors, and i need to define just Z somehow, but i have no clue how to do that
Edit:
Actually, thinking about it, you only need Z axis to be lerped, so:
var pos = cameraObject.getLocalPosition();
var zAxis = pos.z;
var z = pc.math.lerp(zAxis , playerPosition.z, 5 * dt);
cameraObject.setLocalPosition(pos.x, pos.y, z);
I see. So, your camera changes views. Lerping only a single Z axis is not enough for the side view. You should find the optimal position of the camera, that is where it should end up at, and lerp to that target using all 3 axis.