# --- Test 48. Use Camera3D node. --- # import nodesnim Window("camera 3d test", 1024, 640) build: - Scene main: - Node3D root: call translate(2, 2, -5) - Camera3D camera: call setCurrent() call changeTarget(root) - GeometryInstance cube: translation: Vector3(-1, 0, 2) color: Color(122, 133, 144, 0.8) - GeometryInstance cube1: translation: Vector3(2, 0, -2) color: Color(144, 144, 122, 0.8) - GeometryInstance cube2: translation: Vector3(1, 2.5, 1) color: Color(144, 111, 144, 0.8) - GeometryInstance sphere: translation: Vector3(-1, -1, 1) color: Color(144, 77, 144, 1.0) geometry: GEOMETRY_SPHERE - ProgressBar health: call resize(256, 48) call setAnchor(0, 1, 0, 1) call setProgress(50) call setProgressColor(Color("#a77")) call setBackgroundColor(Color(222, 222, 222, 0.5)) addKeyAction("forward", "w") addKeyAction("back", "s") addKeyAction("left", "a") addKeyAction("right", "d") root@on_input(self, event): if event.isInputEventMouseMotion() and event.pressed: camera.rotate(-event.xrel*0.1, event.yrel*0.1) if isActionPressed("left"): root.translate(camera.right * -0.1) if isActionPressed("right"): root.translate(camera.right * 0.1) if isActionPressed("forward"): root.translate(camera.front*0.1) if isActionPressed("back"): root.translate(camera.front*(-0.1)) addMainScene(main) windowLaunch()