How to use lerpAngle? Looks like I’m doing sth wrong I want to lerp angle from 0 to 180 degrees on press key left or right
update(dt) {
const left = pc.app.keyboard.wasPressed(pc.KEY_LEFT);
const right = pc.app.keyboard.wasPressed(pc.KEY_RIGHT);
this.rotate(left, right);
}
rotate(left, right) {
const height = 1;
const distance = 4;
const lookAtPointPos = this.lookAtPoint.getPosition();
orbitAngle = pc.math.lerpAngle(orbitAngle, 180, 0.5);
this.entity.setLocalPosition(lookAtPointPos);
this.entity.setEulerAngles(0, orbitAngle, 0);
this.entity.translateLocal(0, height, distance);
this.entity.lookAt(lookAtPointPos);
if(left){
orbitAngle -= 180;
}
if(right){
orbitAngle += 180;
}
}