Camera move idle

How would I make it so if the W,A,S,D keys are not pressed, the camera would move up down diagonal left right?

Hi @Mason_Rocchio! Your question is not clear to me. Can you rephrase your question please?

So when I am not pressing W A S or D the camera would move slowly up down left right and diagonally in a random order. The camera would repeat this process until I press W A S or D.

1 Like

Hi @Mason_Rocchio,

You will have to refactor your camera movement code to keep moving the player, based on the last input provided.

So for example if you press W and your player isn’t moving, you can toggle a property to the opposite value (true vs false):

// on initialize
this.movingForward = false;
// on your update method
if(this.app.keyboard.wasReleased(pc.KEY_W)){
   this.movingForward = !this.movingForward;
}

// now use that property to move your player forwad
if(this.movingForward){
   // code to move forward
}
1 Like