ssatguru / BabylonJS-CharacterController

A CharacterController for BabylonJS
Apache License 2.0
216 stars 46 forks source link

Update CharacterController.ts #13

Closed dad72 closed 4 years ago

dad72 commented 4 years ago

Hi,

Several small changes for the detection of keyboard keys. No need for keyCode and fromCharCode

Directly use e.key which allows you to obtain the SPACE, SHIFT and TAB keys and the others (without capital letters). Simpler for users / players.

I put everything in a switch (e.key) because faster.

All that is set function public set***Code(code: number) becomes useless.

In addition it seems to me that keyCode and fromCharCode become obsolete or the sound already.

I test is everything works.

ssatguru commented 4 years ago

@dad72 Thanks for this. I didn't realize keyCode and charCode were obsolete Code is much cleaner now :) Did this solve your "Z" problem?

dad72 commented 4 years ago

In fact as I explained in the comments, the jump happens when I release SHIFT.

I have to face Z + SHIFT + SPACE and release SHIFT and skip this product. Otherwise I use TAB which locks "run", then only Z and space to jump (it works.)