ngokevin
ngokevin

Reputation: 13233

How to disable keyboard or WASD controls in A-Frame?

How to disable the keyboard controls for the camera in the default scene?

<a-scene></a-scene>

Upvotes: 6

Views: 5055

Answers (1)

ngokevin
ngokevin

Reputation: 13233

The wasd-controls component is attached to the default camera by default. You can either:

Define <a-camera> with wasd-controls disabled to override the default one:

<a-scene><a-camera wasd-controls-enabled="false"></a-camera></a-scene>

Or remove it with removeAttribute (when the scene is ready):

document.querySelector('[camera]').removeAttribute('wasd-controls');

Or define a raw camera without wasd-controls:

<a-entity camera="userHeight: 1.6" look-controls></a-entity>

Upvotes: 11

Related Questions