Introduction to SteamVR---VRTK developed by Unity

1. What is VRTK
The full name of VRTK is Virtual Reality Toolkit, formerly known as SteamVR Toolkit. Since the subsequent version began to support SDKs of other VR platforms, such as Oculus, Daydream, GearVR, etc., it was renamed VRTK. It is a powerful tool for VR interactive development using Unity. In principle, developers can use 20% of the time to complete 80% of the VR interactive development content.
Just search for VRTK on the Unity Asset Store   to download and import (you can download it according to the version that VRTK was updated to at that time, and you may not be able to download the version 3.2.0 of lz).
The picture below is a picture shared by the author of VRTK on Twitter. The author uses the golden thinking circle to tell everyone: why VRTK is developed, what method is used, and what VRTK is.
2. VRTK can realize most of VR development

In terms of interactive effects, developers only need to mount a few scripts, and then set related properties to achieve the functions we want:
  • Support SteamVR, Oculus, Daydream and other SDKs
  • VR simulator, no need for VR hardware to debug
  • Laser pointer based on helmet and handle
  • Curved pointer based on helmet and handle
  • play area cursor
  • pointer interaction
  • Can set drag and drop area for objects
  • Multiple movement methods: Teleportation, Dash Movement, Touchpad Movement, Move in place/Run in place Movement
  • the climb
  • Object interaction: Touching, Grabbing, Using
  • Two-handed linkage operation objects: zooming, submachine guns and other objects that need to be held with both hands
  • object highlight
  • Handle Vibration Feedback
  • Handle Effect: Highlight, Transparent, Hidden
  • Prefabricated ways of interacting with common objects: buttons, levers, doors, drawers, sliders, handles
  • Panel menu, Lagoon menu
  • Use the pointer to interact with UGUI
  • Drag and drop UI elements
  • ...
VRTK conducts corresponding interactive development through event-driven. For various events sent by the handle, use the VRTK_Controller_Event script, which is the first script to be mounted on the handle controller during the configuration process. In addition, for other interactive events, corresponding unity event processing will also be provided, such as VRTK_BasicTeleport_UnityEvents (teleport event processing), VRTK_InteractGrab_UnityEvents (grab event processing), VRTK_InteractTouch_UnityEvents (touch event processing), for different stages of each event, will There is a corresponding processing interface, which is similar to the OnClick event processing form of Button in uGUI. Of course, you can also manually add event handlers through code.
3. Examples currently supported by VRTK
The VRTK version is VRTK 3.2.0
Through the demo test provided by the plug-in, the summary example is as follows:
001_CameraRig_VRPlayArea
Simple scene showing usage of [CameraRig] prefab.
002_Controller_Events
A simple scenario that displays events from a controller in a console window.
003_Controller_SimplePointer
A scene with basic objects that activate a laser beam from a controller by pressing the Touchpad. Pointer events are also displayed in the console window.
004_CameraRig_BasicTeleport
A scene with basic objects that can be traversed using the controller laser beam to point to objects in the game world where the user will teleport to by pressing the Touchpad controller. When the Touchpad is released, the user is teleported to where the laser beam ends.
005_Controller_BasicObjectGrabbing
A scene with selection objects that can be grabbed by touching them with the controller and pressing the Grip button. Releasing the grab button will propel the object in the direction and speed of the grab controller. The scene also demonstrates simple highlighting of objects when the controller touches them. Interaction events are also displayed in the console window.
006_Controller_UsingADoor
Scenes with a door interactable set to usable When the door is used by pressing the controller Trigger button, the door opens (or closes if the door is already open).
007_CameraRig_HeightAdjustTeleport
Instead of selecting objects of different heights, the controller can be used to point the laser beam at an object and if the laser beam is pointed at the top of the object then the user is passed to the top of the object to be traversed through the scene. Additionally, it states that if the user steps into a part of the game area that is not on an object, the user will fall to the closest object. This also enables users to climb objects just by standing on them, as the floor detection is done from the position of the headset.
008_Controller_UsingAGrabbedObject
A scene with interactable objects that can be grabbed (press the Grip controller button) and then used (press the Trigger controller button). There's a gun on the table that can be picked up to shoot, or an odd box that when picked up and uses the top to spin.
009_Controller_BezierPointer
However, a scene with a selection of objects of different heights that can be traversed using the controller, instead of just pointing to a straight beam, this beam is curved (on a Bezier curve) which allows climbing on items that the user cannot see.
010_CameraRig_TerrainTeleporting
A scene with terrain objects and a selection of 3d objects of different heights that can be traversed with the controller laser beam pointer. It shows how height adjustment teleporters can be used to climb and lower game objects and traverse terrain.
011_Camera_HeadSetCollisionFading
In a scene with three walls around the play area, if the user places their head into any of the collidable walls, the headset will fade to black to prevent unwanted object clipping artifacts from being seen.
012_Controller_PointerWithAreaCollision
A scene that demonstrates how to traverse the world with a controller pointer but the beam shows the projected play area space and if the space collides with any objects, the teleport operation is disabled. This means that it is possible to create levels of areas that the user cannot teleport to, as they allow the user to clip into objects.
013_Controller_UsingAndGrabbingMultipleObjects
A scene that demonstrates how to grab an interactable object by holding down the grab button continuously or pressing the grab button once to pick it up and releasing it again. The scene also shows that the use button can be held down to continue use or pressed once to start use and again to stop use. This allows multiple objects to enter their usage state at the same time, as shown in this example scene.
014_Controller_SnappingObjectsOnGrab
A scene with selected objects demonstrating different snaps to the controller mechanism. The two green guns, the light saber and the sword use a Snap Handle which uses an empty game object as a child of the interactable object as the direction point to grab so the object's rotation and position match the given rotation and position Snap Handle. The red gun uses basic snapping, doesn't require precision, and doesn't provide a snap handle that doesn't affect object rotation but centers the object to the snap point on the controller. Red/Green guns utilize Precision Snap that does not affect the rotation or position of the grabbed object, and picks up objects where the controller snap point touches the object.
015_Controller_TouchpadAxisControl
R/C car scene controlled using controller touchpad. Moving a finger up and down on the touchpad will cause the car to move forward or backward. Moving a finger to the left or right Touchpad causes the car to turn in that direction. Pressing the Trigger will cause the car to jump, this utilizes the trigger shaft, the more you press the trigger, the higher the car will jump.
016_Controller_HapticRumble
A scene with a breakable box and a sword. The sword can be picked up and swung around in the box. The controller rumbles with just the right amount of vibration, depending on how hard the sword hits the box. If struck hard enough by the sword, the box will also come apart.
017_CameraRig_TouchpadWalking
A scene that demonstrates how to use the touchpad to move around the game world by swiping the finger forward and back to move in that direction. Slide your finger left or right on the touchpad in that direction. Rotation is accomplished by the user in the game physically rotating their body in place space, and whichever way the headset looks is the way the user is walking forward. Crouching is also possible, as demonstrated in this scene, and combined with the headset collision fade script, it can detect unwanted collisions (for example, if the user is standing while walking while crouching) and reset its position to Last known location.
018_CameraRig_FramesPerSecondCounter
Scene showing frames per second in the center of the headset view. Pressing the trigger spawns a new sphere, and pressing the touchpad spawns ten new spheres. Eventually when there are a lot of spheres, the FPS will drop and show the prefab.
019_Controller_InteractingWithPointer
A scene showing how the controller pointer beam can be used to toggle usage actions on interactable objects. Pressing the touchpad to activate the beam and aiming it at an object will toggle its use. It also demonstrates how to create game menus that can trigger actions by using interactable objects that snap to game objects. Pressing the app menu button displays the cube connected to a controller with menu options. Pointing the beam at another controller on the cube will select the menu option accordingly.
020_CameraRig_MeshTeleporting
A scene of an object with a mesh collider to demonstrate how a height adjustment teleporter can be used to climb objects up and down using a mesh collider.
021_Controller_GrabbingObjectsWithJoints
A scene with a collection of stretchable objects that are attached to other objects with joints. This example shows that Interactable Objects can have different attachment mechanisms to determine the best way to connect objects to controllers. Fixed joints are good for holding objects like cubes because they track the controller perfectly, while spring joints work well on drawers, allowing them to slide naturally while operating. Finally, the swivel track works well on the door, allowing for natural control over the swing of the door. There is also a character joint object that can manipulate different shapes by pulling each relevant part.
022_Controller_CustomBezierPointer
A scene that demonstrates how a Bezier pointer can pass complex objects to it to generate a tracker beam and the pointer's cursor. In the scene, a particle object with rotation is used to demonstrate the different appearance of the Bezier pointer beam.
023_Controller_ChildOfControllerOnGrab
A scene that demonstrates the grabbing mechanism, where the grabbed object becomes a child of the controller's grabbing. This is for objects that need to absolutely follow the controller, and don't want to be disjointed in any case. This object becomes an extension of the controller. This is demonstrated live with the bow example, where the bow can be picked up and tracked to a controller, and another controller is responsible for picking up arrows to shoot in the bow.
024_CameraRig_ExcludeTeleportLocation
A scenario showing how certain objects can be excluded from remote migration by applying named tags to objects or by applying scripts with specific names. In the scene, yellow objects are excluded from teleport positions by setting the ExcludeTeleport flag on them, and black objects are excluded by a script with ExcludeTeleport attached to them. The ExcludeTeleport script has no methods and is just used as a placeholder.
025_Controls_Overview
A scene showing existing interactive controls, different ways of setting them up and reacting to the events they send.
026_Controller_ForceHoldObject
A scene showing how to grab an object at the start of the game and prevent the user from dropping it. The scene automatically grabs two swords to each controller, and it's impossible to drop either sword.
027_CameraRig_TeleportByModelVillage
A scene that demonstrates how to teleport to different locations without the need for a world pointer and use the target event abstract class on the object representing the mini-map of the game world. Touch and use objects on the map to teleport the user to a specified location.
028_CameraRig_RoomExtender
A scenario that demonstrates the concept of expanding the scale space of a physics room space by multiplying the physics steps in the companion boundary. A higher multiplier means the user can walk further in the game area, and the walk multiplier can be toggled by pressing a button.
029_Controller_Tooltips
A scene that demonstrates adding tooltips to game objects and controllers using prefabs ObjectTooltip and prefabs ControllerTooltips.
030_Controls_RadialTouchpadMenu
A scene that demonstrates adding a dynamic radial menu to controllers and other objects using the RadialMenu prefab.
031_CameraRig_HeadsetGazePointer
A scene demonstrating the ability to attach a pointer to a headset to allow gaze pointers for teleportation or other interactions powered by world pointers. The Touchpad right controller activates the gaze beam, while the Touchpad left controller activates the beam projected from the sky as the world pointer drone can attach to any object.
032_Controller_CustomControllerModel
A scene that demonstrates how to use a custom model of a controller instead of the default HTC Vive controller. It uses two simple pointers instead of the default controller and shows a simple state change based on whether the grab button is pressed or the button is used.
033_CameraRig_TeleportingInNavMesh
A scene that demonstrates how to use a baked NavMesh to define the areas the user is allowed to teleport to.
034_Controls_InteractingWithUnityUI
A scene that demonstrates how to interact with Unity UI elements. The scene uses a VRTK_UIPointer script on the right controller, allowing interaction with Unity UI elements using a simple pointer beam. The left controller controls a simple pointer on the headset to demonstrate gaze interaction with Unity UI elements.
035_Controller_OpacityAndHighlighting
A scene that demonstrates how to change the opacity of a controller and how to highlight controller elements such as buttons or even entire controller mockups.
036_Controller_CustomCompoundPointer
A scene that demonstrates how the Bezier pointer can only reveal objects (teleport beams) when the teleport position is valid, and can create animation trails along the trace curve. This scene provides a textured environment for testing teleportation, with some active "plasma" orbs on the wall that can be activated with a pointer, and another that can be grabbed and launched.
037_CameraRig_ClimbingFalling
A scene that demonstrates how to set up a climbing mechanism with different activities. Various objects with VRTK_InteractableObject components are scattered throughout the level. They both have GrabAttachMechanic set to Climbable.
038_CameraRig_CameraRig_DashTeleport
A scene that shows teleportation in action and demonstrates methods for using the broadcast's RaycastHit array. In the example, the obstacle in the dash way closes its mesh renderer while the dash is in progress.
039_CameraRig_AdaptiveQuality
Only compatible with Unity 5.4 and higher
The scene displays frames per second in the center of the headset view. The debug visualization for this script is shown near the top edge of the headset view. Pressing the trigger spawns a new sphere, and pressing the touchpad spawns ten new spheres. Eventually when there are a lot of spheres, the FPS will drop and demo the script.
040_Controls_PanelMenu
A scene that demonstrates how to attach an interactable panel prefab to a game object to provide additional settings.
041_Controller_ObjectSnappingToDropZones
A scene that uses the VRTK_SnapDropZone prefab to set up a predetermined snap zone for a range of objects, and demonstrates how to snap only certain types of objects to certain zones.
042_CameraRig_MoveInPlace
A scene that demonstrates how the user can move and traverse colliders by swinging the controller in a walking fashion or by running live using head bobbing motion.
043_Controller_SecondaryControllerActions
A scene that demonstrates the ability to grab an object with one controller and scale it by grabbing and pulling on a second controller.
044_CameraRig_RestrictedTeleportZones
Use the VRTK_DestinationPoint prefab to set up a scene with a collection of predefined teleport locations.

Guess you like

Origin blog.csdn.net/u013774978/article/details/130022519