[SOLVED] How to handle this camera "lag" when moving back?

Hello, there are delays when traveling back at high speed, do you have any idea why this happens?


Maybe it’s related to entity order/distance?
Capture

Thanks for any information

Can you post a link to your project?

Hi, there’s a reproduction
https://playcanvas.com/project/1020654/overview/test
Hold key ‘S’ to move backwards, don’t mind the logic, it’s not meant to be a human movement :grinning:

Seems like it was related to camera movement script,
For some reason this

    var originEntity = this.entity.parent;

    var targetY = this.eulers.x + 180;
    var targetX = this.eulers.y;

    var targetAng = new pc.Vec3(-targetX, targetY, 0);

    originEntity.setEulerAngles(targetAng);

    this.entity.setPosition(this.getWorldPoint());

    this.entity.lookAt(originEntity.getPosition());

Was under postUpdate, running it on update fixed the issue :thinking:

1 Like