MCPcopy Create free account
hub / github.com/BabylonJS/BabylonNative / CreateInputHandling

Function CreateInputHandling

Apps/Playground/Scripts/experience.js:32–50  ·  view source on GitHub ↗
(scene)

Source from the content-addressed store, hash-verified

30}
31
32function CreateInputHandling(scene) {
33 var inputManager = new InputManager();
34 var priorX = inputManager.pointerX;
35 var priorY = inputManager.pointerY;
36 var x = 0;
37 var y = 0;
38 scene.onBeforeRenderObservable.add(function () {
39 x = inputManager.pointerX;
40 y = inputManager.pointerY;
41
42 if (inputManager.isPointerDown) {
43 scene.activeCamera.alpha += 0.01 * (priorX - x);
44 scene.activeCamera.beta += 0.01 * (priorY - y);
45 }
46
47 priorX = x;
48 priorY = y;
49 });
50}
51
52var engine = new BABYLON.NativeEngine();
53var scene = new BABYLON.Scene(engine);

Callers 1

experience.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected