Designing the Input System
The topic of the User Interface (UI) often focuses quite heavily on visual elements, layout, and design. For the majority of web applications, the basics of tracking a pointer, touches, or taps along with keyboard input are handled by the web browser, which in turn delegates many responsibilities, such as hardware driver interfacing to the underlying Operating System (OS). When using a web-native application library such as Babylon.js, developers can take advantage of these already-present abstractions to make it quick and easy to add user interaction elements to their scenes. In this section, we’ll learn how to add the application scaffolding that can support multiple types of inputs on-the-fly, followed by implementing a way to map arbitrary inputs to actions or commands in the game.
It’s said that imitation is the sincerest form of flattery, so let’s flatter the Babylon.js team by “stealing” (called “researching...