Now I turn it like this:
document.addEventListener('keydown', (e) => {
if(isStart && e.keyCode == 37 || e.keyCode == 65)
{
this.player.position.x > -1 ? this.player.position.x -= 1.2 : ''
this.camera.position = new BABYLON.Vector3(this.player.position.x, 2, -35)
}
if(isStart && e.keyCode == 39 || e.keyCode == 68)
{
this.player.position.x < 1 ? this.player.position.x += 1.2 : ''
this.camera.position = new BABYLON.Vector3(this.player.position.x, 2, -35)
}
})
As you can see I have a space constraint. It should be so.
But now my character is very sharply (instantly) to the left or right. How do I fix this?