-
Notifications
You must be signed in to change notification settings - Fork 1
Movement
Currently, the movement does not change with vision switch. Therefore, you must consider what the main movement of the native animal is, then add the relevant movement prefabs to the scene to allow for that movement.
These are prefabs that control a specific type of player movement, like teleport or fly. Each movement prefab has its own script depending on the type of movement (e.g. the Teleport prefab should have the TeleportController.cs
script). Currently we have the following movement prefabs:
Add the movement prefabs you want your scene to support.
The Teleport prefab consists of the TeleportController.cs
script. On the TeleportController.cs
script, you can adjust which layers the raycast can detect, which layers can be teleported to, the teleport distance, and the button to trigger teleportation. You can also adjust the line renderer colors.
The TeleportController
script allows users to teleport around a scene. To use it, add an instance of the script to any object in the scene. There is already a Teleport
prefab setup in prefabs that you can just drag into your scene. It can be used with the HapticsController
prefab to use haptics to indicate what is a valid teleport location.
- In the
Camera Rig
parameter, drag yourOVRCameraRig
. This is the object that will be moved whenever a teleport occurs. - In the
Ray Origin
field, put the object that you wish to be the source of the teleport ray. In virtually all cases, this will be either theRightHandAnchor
orLeftHandAnchor
under theOVRCameraRig
'sTrackingSpace
. -
Valid Raycast Layers
is the list of layers that the raycast will collide with. The teleport ray will pass through layers not on this list. -
Valid Teleport Layers
is the list of layers that the user is allowed to teleport to. If the ray intersects an object on a layer on this list, it will change to the valid color, indicating the teleport is valid. If the ray intersects an object on a layer not on this list, it will turn to the invalid color. - Set
Teleport Button
to the button that must be pressed (and held) to show the teleport ray. When this button is released while the ray intersects an valid teleport layer, theCamera Rig
will be moved to the ray's point of intersection. - Set
Teleport Range
to the maximum range a user can teleport. - For the teleport ray to appear visually, it must be represented by a
Line Renderer
. Pass anyLine Renderer
to theLine Renderer
parameter, which will then be used to render the teleport ray. - Set
Valid Color
to the color you want the teleport ray to become when intersecting a valid surface. - Set `Invalid Color to the color you want the teleport ray to become when intersecting an invalid surface.
Generally, you should reduce the line's width to somewhere around .01'. Also, ensure that
Element 0under
Materialsis set to
Default-Line`. (a default Unity material).
The Teleport
prefab already has most of the correct settings, and is therefore simpler to use.
- Drag an instance of the prefab into the scene.
- Make sure to set the
Camera Rig
andRay Origin
properties properly, as mentioned above. - Additionally, you may want to modify the
Valid Raycast Layers
,Valid Teleport Layers
, andTeleport Range
to tailor theTeleport
to the scene.
The Fly
prefab consists of the FlightController.cs
script. This takes care of moving the headset forward and turning on wind particles and wind sound to simulate flying.
- Drag an instance of the prefab into the scene.
- Drag in the
OVRCamerRig
to theCamera Rig
slot in the inspector. - Drag in the
CenterEyeAnchor
of the OVRCameraRig to theCenter Eye
slot in the inspector. - Adjust the flight speed and how fast you want the headset to fade in and out when you stop and start flying.