Difference between revisions of "Virtual Reality Cameras"

From PowerUI
Jump to: navigation, search
(Making it click)
Line 33: Line 33:
 
== Making it click ==
 
== Making it click ==
  
See the section on [Input Pointer#Making it click|input pointers] about making them click.
+
See the section on [[Input Pointer#Making it click|input pointers]] about making them click.

Revision as of 18:56, 22 March 2017

In virtual reality, it's common to see the middle of the screen being used as the input pointer. Think Minecraft and similar. Here's how you set that up in PowerUI using the CameraPointer class.

Note that the UI's you create would almost always be one or more WorldUI's.

Creating a CameraPointer

  • You'll probably want to turn off the mouse pointer (It's used on desktops only). It's the input pointer which is controlled by the mouse.
  • In an Awake method, create a CameraPointer for a particular camera.

Here's an example:

CameraPointer MyPointer;

void Awake(){

  // Disable the system mouse:
  PowerUI.Input.CreateSystemMouse=false;
  
  // Create a camera pointer that sits in the middle of the screen (50%,50%):
  MyPointer = new CameraPointer(Camera.main,0.5f,0.5f);
  
  // Add it now:
  MyPointer.Add();

}

Whenever the camera you gave is transformed (i.e. rotated or moved around), the pointer automatically updates itself.

Making it click

See the section on input pointers about making them click.