👋
NRSDK(Old)
v1.10.2
v1.10.2
  • NRSDK Fundamentals
    • NRSDK Overview
    • XREAL Devices
      • XREAL Glasses
      • Controller
      • Compatibility
    • Getting Started with NRSDK
    • Sample Code
    • Tutorials
    • Release Note
      • NRSDK 1.10.2
      • NRSDK 1.9.5
      • NRSDK 1.9.3
      • NRSDK 1.9.1
      • NRSDK 1.8.0
      • NRSDK 1.7.0
      • NRSDK 1.6.0
  • Development
    • Input and Camera
      • NRInput
      • Interact with Unity UI (Tutorial)
      • Customize Controller UI
      • NRCameraRig
    • Hand Tracking
    • Image Tracking
    • Plane Detection (Tutorial)
      • Overview
      • Import the package
      • Detect planes in the real world
      • Perform a hit test against detected planes
      • Add a car
      • Add gems
      • Wrap up
    • Depth Mesh
      • Meshing Manager Overview
      • Use Meshes in the Editor
      • Tutorial: Mesh Collision
    • Tools
      • First Person View
      • Emulator
      • Notification popup
      • Reset Camera
    • MRTK Integration
  • Advanced
    • Access RGB Camera
    • NRSDK Coordinate Systems
  • XR Streaming
  • Frequently Asked Questions
Powered by GitBook
On this page
  • Introduction
  • Developer Guide

Was this helpful?

  1. Development
  2. Tools

Reset Camera

PreviousNotification popupNextMRTK Integration

Last updated 1 year ago

Was this helpful?

Introduction

If you're building a seated or standing experience, you can recenter Unity's world origin at the user's current position and orientation by calling the API NRHMDPoseTracker.ResetWorldMatrix . The HelloMR-ResetCamera sample scene demonstrates how to reset the camera with this API in an app.

The main script is CameraResetController.cs which uses a boolean to support reset camera with pitch as well.

Developer Guide

  1. Create a new project in Unity with NRSDK. Refer to for more setting up instructions.

  2. Create a canvas and a button;

  3. Drag the script CameraSmoothFollow.cs to the inspector of canvas for sticking the menu in your view so you can click your reset button easily. You can adjust the speed of the button moving with your view with Follow Speed.

  4. Drag the script CameraResetController.cs and CanvasRaycastTarget.cs to the inspector of canvas;

  5. Set the OnClick() event of your button, drag the canvas to the event;

  6. Choose the function CameraResetController -> ResetCameraToOrigin(bool)

  7. That's it. You can build your app and test the recenter effect. If you want to reset the camera with pitch, just repeat the upper steps and choose the check box.

Getting Started with NRSDK