virtualJoysticksCamera.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { FreeCamera } from "./freeCamera.js";
  2. import { Vector3 } from "../Maths/math.vector.js";
  3. import { Node } from "../node.js";
  4. import "./Inputs/freeCameraVirtualJoystickInput.js";
  5. Node.AddNodeConstructor("VirtualJoysticksCamera", (name, scene) => {
  6. return () => new VirtualJoysticksCamera(name, Vector3.Zero(), scene);
  7. });
  8. /**
  9. * This represents a free type of camera. It can be useful in First Person Shooter game for instance.
  10. * It is identical to the Free Camera and simply adds by default a virtual joystick.
  11. * Virtual Joysticks are on-screen 2D graphics that are used to control the camera or other scene items.
  12. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_introduction#virtual-joysticks-camera
  13. */
  14. export class VirtualJoysticksCamera extends FreeCamera {
  15. /**
  16. * Instantiates a VirtualJoysticksCamera. It can be useful in First Person Shooter game for instance.
  17. * It is identical to the Free Camera and simply adds by default a virtual joystick.
  18. * Virtual Joysticks are on-screen 2D graphics that are used to control the camera or other scene items.
  19. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_introduction#virtual-joysticks-camera
  20. * @param name Define the name of the camera in the scene
  21. * @param position Define the start position of the camera in the scene
  22. * @param scene Define the scene the camera belongs to
  23. */
  24. constructor(name, position, scene) {
  25. super(name, position, scene);
  26. this.inputs.addVirtualJoystick();
  27. }
  28. /**
  29. * Gets the current object class name.
  30. * @returns the class name
  31. */
  32. getClassName() {
  33. return "VirtualJoysticksCamera";
  34. }
  35. }
  36. //# sourceMappingURL=virtualJoysticksCamera.js.map