Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation gizmo setup #68

Merged
merged 29 commits into from Sep 22, 2022
Merged

Navigation gizmo setup #68

merged 29 commits into from Sep 22, 2022

Conversation

JujieX
Copy link
Collaborator

@JujieX JujieX commented Sep 7, 2022

#66

import {
  Camera,
  Color,
  DirectLight,
  GLTFResource,
  Layer,
  Vector3,
  WebGLEngine,
} from "oasis-engine";
import { LitePhysics } from "@oasis-engine/physics-lite";
import { OrbitControl,NavigationGizmo } from "oasis-engine-toolkit";

const engine = new WebGLEngine("canvas");
 // must initialize physics engine becuase it will use raycast
engine.physicsManager.initialize(LitePhysics);
engine.canvas.resizeByClientSize();
const scene = engine.sceneManager.activeScene;
const { background } = scene;
background.solidColor = new Color(0.8, 0.8, 0.8, 1);
const rootEntity = scene.createRootEntity();

// init full screen camera
const cameraEntity = rootEntity.createChild("fullscreen-camera");
const camera = cameraEntity.addComponent(Camera);

cameraEntity.transform.setPosition(10, 0, 0);
cameraEntity.transform.lookAt(new Vector3(0, 0, 0));

// control
cameraEntity.addComponent(OrbitControl);

const lightEntity = rootEntity.createChild("Light");
lightEntity.transform.setRotation(-30, 0, 0);
lightEntity.addComponent(DirectLight);

// add navigation gizmo
const navigationGizmo = rootEntity.addComponent(NavigationGizmo);
navigationGizmo.camera = camera;

engine.resourceManager
  .load<GLTFResource>(
    "https://gw.alipayobjects.com/os/OasisHub/6f17aed5-db52-4ebf-9eca-2eb61a2a9260/oasis-file/1663209141412/Suzanne.gltf"
  )
  .then((gltf) => {
    rootEntity.addChild(gltf.defaultSceneRoot);
  });

engine.run();

@yangfengzzz yangfengzzz requested review from yangfengzzz and removed request for GuoLei1990 September 13, 2022 06:14
@yangfengzzz yangfengzzz added the enhancement New feature or request label Sep 13, 2022
@yangfengzzz yangfengzzz added high priority High priority issue feature New feature and removed enhancement New feature or request labels Sep 13, 2022
@yangfengzzz yangfengzzz added this to the 0.9 milestone Sep 13, 2022
packages/navigation-gizmo/package.json Show resolved Hide resolved
packages/navigation-gizmo/src/NavigationGizmo.ts Outdated Show resolved Hide resolved
packages/navigation-gizmo/src/NavigationGizmo.ts Outdated Show resolved Hide resolved
packages/navigation-gizmo/src/NavigationGizmo.ts Outdated Show resolved Hide resolved
packages/navigation-gizmo/src/NavigationGizmo.ts Outdated Show resolved Hide resolved
packages/navigation-gizmo/src/SphereScript.ts Outdated Show resolved Hide resolved
packages/navigation-gizmo/src/SphereScript.ts Outdated Show resolved Hide resolved
packages/navigation-gizmo/src/EndScript.ts Outdated Show resolved Hide resolved
packages/navigation-gizmo/src/EndScript.ts Outdated Show resolved Hide resolved
packages/navigation-gizmo/src/EndScript.ts Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Sep 20, 2022

Codecov Report

Base: 5.76% // Head: 5.76% // No change to project coverage 👍

Coverage data is based on head (2f29a98) compared to base (44f4d74).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##           dev/0.9     #68   +/-   ##
=======================================
  Coverage     5.76%   5.76%           
=======================================
  Files            9       9           
  Lines          347     347           
  Branches        63      63           
=======================================
  Hits            20      20           
  Misses         323     323           
  Partials         4       4           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

This was linked to issues Sep 21, 2022
@yangfengzzz yangfengzzz changed the title Feat: navigation gizmo setup Navigation gizmo setup Sep 21, 2022
@yangfengzzz yangfengzzz merged commit e08c9f0 into galacean:dev/0.9 Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature high priority High priority issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC: Navigation Gizmo Navigation gizmo
4 participants