The
Simple Pointer emits a coloured beam from the end of the controller to
simulate a laser beam. It can be useful for pointing to objects within a
scene and it can also determine the object it is pointing at and the
distance the object is from the controller the beam is being emitted
from.
The
laser beam is activated by default by pressing the Grip on the
controller. The event it is listening for is the AliasPointerevents so
the pointer toggle button can be set by changing the Pointer Toggle
button on the VRTK_ControllerEvents script parameters.
The
Simple Pointer script is attached to a Controller object within the
[CameraRig] prefab and the Controller object also requires the
VRTK_ControllerEvents script to be attached as it uses this for
listening to the controller button events for enabling and disabling the
beam.
· Enable Teleport:
If this is checked then the teleport flag is set to true in the
Destination Set event so teleport scripts will know whether to action
the new destination. This allows controller beams to be enabled on a
controller but never trigger a teleport (if this option is unchecked).
· Pointer Hit Color: The colour of the beam when it is colliding with a valid target. It can be set to a different colour for each controller.
· Pointer Miss Color: The colour of the beam when it is not hitting a valid target. It can be set to a different colour for each controller.
· Show Play Area Cursor: If this is enabled then the play area boundaries are displayed at the tip of the pointer beam in the current pointer colour.
· Play Area Cursor Dimensions:
Determines the size of the play area cursor and collider. If the values
are left as zero then the Play Area Cursor will be sized to the
calibrated Play Area space.
· Handle Play Area Cursor Collisions:
If this is ticked then if the play area cursor is colliding with any
other object then the pointer colour will change to the Pointer Miss
Color and the WorldPointerDestinationSet event will not be triggered,
which will prevent teleporting into areas where the play area will
collide.
· Beam Always On:
If this is checked the the pointer beam is always visible but the
Destination Set event is still only emitted when the assigned button is
pressed.Activate Delay: The time in seconds to delay the pointer beam being able to be active again. Useful for preventing constant teleportation.
· Pointer Thickness:
The thickness and length of the beam can also be set on the script as
well as the ability to toggle the sphere beam tip that is displayed at
the end of the beam (to represent a cursor).
· Pointer Length: The distance the beam will project before stopping.
· Show Pointer Tip: Toggle whether the cursor is shown on the end of the pointer beam.
· Point Hit Color(指针碰撞颜色):当光束和一个有效目标碰撞的颜色。每个控制器可以有不同的颜色设置。
· Pointer Miss Color(指针无碰撞颜色):当光束没有命中有效目标时的颜色。每个控制器可以有不同的颜色设置。
· Show Play Area Cursor(显示游玩区光标):如果这个启动,游玩区界限就会在光束指针的顶端显示出来,颜色和当前指针颜色相同。
· Play Area Cursor Dimensions(游玩去光标尺寸):决定游玩区光标和碰撞的尺寸。如果值为零,Play Area Cursor 的尺寸将根据Play Area空间进行校正。
· Handle Play Area Cursor Collisions(处理游玩区光标碰撞):如果勾选,当游玩区光标和其他物体发生碰撞时,指针颜色就会变成Pointer Miss Color的颜色且WorldPointerDestinationSet 事件将不会被触发,这将防止传送到游玩区会发生碰撞的区域。
The Simple Pointer object extends the VRTK_WorldPointer abstract class and therefore emits the same events and payload.
简单指针对象扩展自VRTK_WorldPointer 抽象类并因此发出相同的事件和有效数据。
An
example of the VRTK_SimplePointer script can be viewed in the
sceneSteamVR_Unity_Toolkit/Examples/003_Controller_SimplePointer and
code examples of how the events are utilised and listened to can be
viewed in the
scriptSteamVR_Unity_Toolkit/Examples/Resources/Scripts/VRTK_ControllerPointerEvents_ListenerExample.cs
The
Bezier Pointer emits a curved line (made out of game objects) from the
end of the controller to a point on a ground surface (at any height). It
is more useful than the Simple Laser Pointer for traversing objects of
various heights as the end point can be curved on top of objects that
are not visible to the player.
The
laser beam is activated by default by pressing the Grip on the
controller. The event it is listening for is the AliasPointerevents so
the pointer toggle button can be set by changing the Pointer Toggle
button on the VRTK_ControllerEvents script parameters.
The
Bezier Pointer script is attached to a Controller object within the
[CameraRig] prefab and the Controller object also requires the
VRTK_ControllerEvents script to be attached as it uses this for
listening to the controller button events for enabling and disabling the
beam.
· Enable Teleport:
If this is checked then the teleport flag is set to true in the
Destination Set event so teleport scripts will know whether to action
the new destination. This allows controller beams to be enabled on a
controller but never trigger a teleport (if this option is unchecked).
· Pointer Hit Color: The colour of the beam when it is colliding with a valid target. It can be set to a different colour for each controller.
· Pointer Miss Color: The colour of the beam when it is not hitting a valid target. It can be set to a different colour for each controller.
· Show Play Area Cursor: If this is enabled then the play area boundaries are displayed at the tip of the pointer beam in the current pointer colour.
· Play Area Cursor Dimensions:
Determines the size of the play area cursor and collider. If the values
are left as zero then the Play Area Cursor will be sized to the
calibrated Play Area space.
· Handle Play Area Cursor Collisions:
If this is ticked then if the play area cursor is colliding with any
other object then the pointer colour will change to the Pointer Miss
Color and the WorldPointerDestinationSet event will not be triggered,
which will prevent teleporting into areas where the play area will
collide.
· Beam Always On:
If this is checked the the pointer beam is always visible but the
Destination Set event is still only emitted when the assigned button is
pressed.
· Activate Delay: The time in seconds to delay the pointer beam being able to be active again. Useful for preventing constant teleportation.
· Pointer Length: The length of the projected forward pointer beam, this is basically the distance able to point from the controller potiion.
· Pointer Density:
The number of items to render in the beam bezier curve. A high number
here will most likely have a negative impact of game performance due to
large number of rendered objects.
· Show Pointer Cursor:
A cursor is displayed on the ground at the location the beam ends at,
it is useful to see what height the beam end location is, however it can
be turned off by toggling this.
· Pointer Cursor Radius:
The size of the ground pointer cursor, This number also affects the
size of the objects in the bezier curve beam. The larger the raduis, the
larger the objects will be.
· Beam Curve Offset:
The amount of height offset to apply to the projected beam to generate a
smoother curve even when the beam is pointing straight.
· Custom Pointer Tracer:
A custom Game Object can be applied here to use instead of the default
sphere for the beam tracer. The custom Game Object will match the
rotation of the controller.
· Custom Pointer Cursor: A custom Game Object can be applied here to use instead of the default flat cylinder for the pointer cursor.
· Point Hit Color(指针碰撞颜色):当光束和一个有效目标碰撞的颜色。每个控制器可以有不同的颜色设置。
· Pointer Miss Color(指针无碰撞颜色):当光束没有命中有效目标时的颜色。每个控制器可以有不同的颜色设置。
· Show Play Area Cursor(显示游玩区光标):如果这个启动,游玩区界限就会在光束指针的顶端显示出来,颜色和当前指针颜色相同。
· Play Area Cursor Dimensions(游玩去光标尺寸):决定游玩区光标和碰撞的尺寸。如果值为零,Play Area Cursor 的尺寸将根据Play Area空间进行校正。
· Handle Play Area Cursor Collisions(处理游玩区光标碰撞):如果勾选,当游玩区光标和其他物体发生碰撞时,指针颜色就会变成Pointer Miss Color的颜色且WorldPointerDestinationSet 事件将不会被触发,这将防止传送到游玩区会发生碰撞的区域。
The Bezier Pointer object extends the VRTK_WorldPointer abstract class and therefore emits the same events and payload.
贝塞尔指针对象扩展自VRTK_WorldPointer 抽象类并因此发出相同的事件和有效数据。
An
example of the VRTK_BezierPointer script can be viewed in the
sceneSteamVR_Unity_Toolkit/Examples/009_Controller_BezierPointer which
is used in conjunction with the Height Adjust Teleporter shows how it is
possible to traverse different height objects using the curved pointer
without needing to see the top of the object.
Another
example can be viewed in the scene
SteamVR_Unity_Toolkit/Examples/012_Controller_PointerWithAreaCollisionthat
shows how a Bezier Pointer with the Play Area Cursor and Collision
Detection enabled can be used to traverse a game area but not allow
teleporting into areas where the walls or other objects would fall into
the play area space enabling the player to enter walls.
The
bezier curve generation code is in another script located at
SteamVR_Unity_Toolkit/Scripts/Helper/CurveGenerator.csand was heavily
inspired by the tutorial and code from Catlike Coding.
The
basic teleporter updates the [CameraRig] x/z position in the game world
to the position of a World Pointer‘s tip location which is set via the
WorldPointerDestinationSet event. The y position is never altered so the
basic teleporter cannot be used to move up and down game objects as it
only allows for travel across a flat plane.
The
Basic Teleport script is attached to the [CameraRig] prefab and
requires an implementation of the WorldPointer script to be attached to
another game object (e.g. VRTK_SimplePointer attached to the Controller
object).
· Blink Transition Speed:
The fade blink speed can be changed on the basic teleport script to
provide a customised teleport experience. Setting the speed to 0 will
mean no fade blink effect is present. The fade is achieved via the
SteamVR_Fade.csscript in the SteamVR Unity Plugin scripts.
· Distance Blink Delay:
A range between 0 and 32 that determines how long the blink transition
will stay blacked out depending on the distance being teleported. A
value of 0 will not delay the teleport blink effect over any distance, a
value of 32 will delay the teleport blink fade in even when the
distance teleported is very close to the original position. This can be
used to simulate time taking longer to pass the further a user
teleports. A value of 16 provides a decent basis to simulate this to the
user.
· Headset Position Compensation:
If this is checked then the teleported location will be the position of
the headset within the play area. If it is unchecked then the
teleported location will always be the centre of the play area even if
the headset position is not in the centre of the play area.
· Ignore Target With Tag Or Class:
A string that specifies an object Tag or the name of a Script attached
to an obejct and notifies the teleporter that the destination is to be
ignored so the user cannot teleport to that location. It also ensure the
pointer colour is set to the miss colour.
· Headset Position Compensation(头盔位置补偿): 如果勾选,传送坐标将会式游玩区内头盔的位置。如果没有勾选,传送坐标将总是游玩区中间的位置,就算头盔位置不在游玩区中间也式如此。
· Ignore Target With Tag Or Class(忽略带有标签或脚本的目标): 一个指定对象标签或者对象上添加的脚本名字的字符串,通知传送器这种目标点应该被忽略,所以用户就不能传送到这些位置上。同时也确保指针颜色被设为丢失目标点颜色。
An
example of the VRTK_BasicTeleport script can be viewed in the
sceneSteamVR_Unity_Toolkit/Examples/004_CameraRig_BasicTeleport. The
scene uses the VRTK_SimplePointer script on the Controllers to initiate a
laser pointer with the Controller Grip button and when the laser
pointer is deactivated (release theGrip) then the player is teleported
to the location of the laser pointer tip.
The
height adjust teleporter extends the basic teleporter and allows for
the y position of the [CameraRig] to be altered based on whether the
teleport location is on top of another object.
Like the basic teleporter the Height Adjust Teleport
script is attached to the [CameraRig] prefab and requires a World
Pointer to be available.
和基础传送器一样,高度调整传送器被添加到[CameraRig]预制并需要一个可用的世界指针。
The following script parameters are available:
可用脚本参数如下:
· Blink Transition Speed: The fade blink speed on teleport.
· Distance Blink Delay:
A range between 0 and 32 that determines how long the blink transition
will stay blacked out depending on the distance being teleported. A
value of 0 will not delay the teleport blink effect over any distance, a
value of 32 will delay the teleport blink fade in even when the
distance teleported is very close to the original position. This can be
used to simulate time taking longer to pass the further a user
teleports. A value of 16 provides a decent basis to simulate this to the
user.
· Headset Position Compensation:
If this is checked then the teleported location will be the position of
the headset within the play area. If it is unchecked then the
teleported location will always be the centre of the play area even if
the headset position is not in the centre of the play area.
· Ignore Target With Tag Or Class:
A string that specifies an object Tag or the name of a Script attached
to an obejct and notifies the teleporter that the destination is to be
ignored so the user cannot teleport to that location. It also ensure the
pointer colour is set to the miss colour.
· Play Space Falling:
Checks if the player steps off an object into a part of their play area
that is not on the object then they are automatically teleported down
to the nearest floor.
· Headset Position Compensation(头盔位置补偿): 如果勾选,传送坐标将会式游玩区内头盔的位置。如果没有勾选,传送坐标将总是游玩区中间的位置,就算头盔位置不在游玩区中间也式如此。
· Ignore Target With Tag Or Class(忽略带有标签或脚本的目标): 一个指定对象标签或者对象上添加的脚本名字的字符串,通知传送器这种目标点应该被忽略,所以用户就不能传送到这些位置上。同时也确保指针颜色被设为丢失目标点颜色。
· Play Space Falling(游玩区坠落):检查是否玩家是否走出对象,即所在游玩区的位置不在对象上,然后就会自动传送到最近的地面上。
The Play Space Falling option also works in the
opposite way that if the player‘s headset is above an object then the
player is teleported automatically on top of that object, which is
useful for simulating climbing stairs without needing to use the pointer
beam location. If this option is turned off then the player can hover
in mid air at the same y position of the object they are standing on.
反过来说Play Space Falling
选项是在玩家头盔在一个对象上方时会自动传送到一个对象的顶部,这一点在模拟爬梯子时很有用,不需要使用指针光束定位。如果这个选项关闭,玩家就能在他们所站在的对象的同样y高度的空中行走(也就是有一部分游玩区在对象外部)。
An example of the VRTK_HeightAdjustTeleport script can
be viewed in the
sceneSteamVR_Unity_Toolkit/Examples/007_CameraRig_HeightAdjustTeleport.
The scene has a collection of varying height objects that the player can
either walk up and down or use the laser pointer to climb on top of
them.
Another example can be viewed in the scene
SteamVR_Unity_Toolkit/Examples/010_CameraRig_TerrainTeleporting which
shows how the teleportation of a player can also traverse terrain
colliders.
Another example can be viewed in the
scene SteamVR_Unity_Toolkit/Examples/020_CameraRig_MeshTeleporting which
shows how the teleportation of a player can also traverse mesh
colliders.
Fading On Headset Collision (VRTK_HeadsetCollisionFade)头盔碰撞淡出(VRTK_HeadsetCollisionFade)
The
purpose of the Headset Collision Fade is to detect when the user‘s VR
headset collides with another game object and fades the screen to a
solid colour. This is to deal with a player putting their head into a
game object and seeing the inside of the object clipping, which is an
undesired effect.
The reasoning behind this is if the player puts their
head where it shouldn‘t be, then fading to a colour (e.g. black) will
make the player realise they‘ve done something wrong and they‘ll
probably naturally step backwards.
An example of the VRTK_HeadsetCollisionFade script can
be viewed in the
sceneSteamVR_Unity_Toolkit/Examples/011_Camera_HeadSetCollisionFading.
The scene has collidable walls around the play area and if the player
puts their head into any of the walls then the headset will fade to
black.
Player Presence (VRTK_PlayerPresence)玩家呈现(VRTK_PlayerPresence)
The
concept that the VR user has a physical in game presence which is
accomplished by adding a collider and a rigidbody at the position the
user is standing within their play area. This physical collider and
rigidbody will prevent the user from ever being able to walk through
walls or intersect other collidable objects. The height of the collider
is determined by the height the user has the headset at, so if the user
crouches then the collider shrinks with them, meaning it‘s possible to
crouch and crawl under low ceilings.
· Headset Y Offset:The
box collider which is created for the user is set at a height from the
user‘s headset position. If the collider is required to be lower to
allow for room between the play area collider and the headset then this
offset value will shorten the height of the generated box collider.
· Ignore Grabbed Collisions:If
this is checked then any items that are grabbed with the controller
will not collide with the box collider and rigid body on the play area.
This is very useful if the user is required to grab and wield objects
because if the collider was active they would bounce off the play area
collider.
· Headset Y Offset(头盔y偏移):为用户创建的盒型碰撞体的高度由用户头盔位置设置。如果需要碰撞体小一点来让游玩区和头盔之间留有空间的话,这个值将降低生成的盒型碰撞体的高度。
An example of theVRTK_PlayerPresencescript
can be viewed in the
sceneSteamVR_Unity_Toolkit/Examples/017_CameraRig_TouchpadWalking. The
scene has a collection of walls and slopes that can be traversed by the
user with the touchpad but the user cannot pass through the objects as
they are collidable and the rigidbody physics won‘t allow the
intersection to occur.
Touchpad Movement (VRTK_TouchpadWalking)触摸板移动 (VRTK_TouchpadWalking)
The
ability to move the play area around the game world by sliding a finger
over the touchpad is achieved using this script. The Touchpad Walking
script is applied to the[CameraRig]prefab
and adds a rigidbody and a box collider to the user‘s position to
prevent them from walking through other collidable game objects.
If the Headset Collision Fade script has been applied
to the Camera prefab, then if a user attempts to collide with an object
then their position is reset to the last good known position. This can
happen if the user is moving through a section where they need to crouch
and then they stand up and collide with the ceiling. Rather than allow a
user to do this and cause collision resolution issues it is better to
just move them back to a valid location. This does break immersion but
the user is doing something that isn‘t natural.
· Left Controller:If this is checked then the left controller touchpad will be enabled to move the play area. It can also be toggled at runtime.
· Right Controller:If this is checked then the right controller touchpad will be enabled to move the play area. It can also be toggled at runtime.
· Max Walk Speed:The
maximum speed the play area will be moved when the touchpad is being
touched at the extremes of the axis. If a lower part of the touchpad
axis is touched (nearer the centre) then the walk speed is slower.
· Deceleration:The
speed in which the play area slows down to a complete stop when the
user is no longer touching the touchpad. This deceleration effect can
ease any motion sickness that may be suffered.
· Left Controller:如果勾选,左控制器的触摸板就能移动游玩区。在运行时可以被切换。
· Right Controller:如果勾选,右控制器的触摸板就能移动游玩区。在运行时可以被切换。
· Max Walk Speed:当触摸板被触摸到轴的极限时游玩区所能达到的最大移动速度。触摸板距离中心越近的位置被触摸,移动速度就越慢。
An example of theVRTK_TouchpadWalkingscript
can be viewed in the
sceneSteamVR_Unity_Toolkit/Examples/017_CameraRig_TouchpadWalking. The
scene has a collection of walls and slopes that can be traversed by the
user with the touchpad. There is also an area that can only be traversed
if the user is crouching. Standing up in this crouched area will cause
the user to appear back at their last good known position.
This
script allows the playArea to move with the player. The CameraRig is
only moved when at the edge of a defined circle. Aims to create a
virtually bigger play area. I have added a demo scene to test the script
(028_CameraRig_RoomExtender).
· Additional Movement Multiplier:This
is the factor by which movement at the edge of the circle is amplified.
0 is no movement of the CameraRig. Higher values simulate a bigger play
area but may be to uncomfortable.
· Head Zone Radius:This
is the size of the circle in which the playArea is not moved and
everything is normal. If it is to low it becomes uncomfortable when
crouching.
· Debug Transform:This
transform visualises the circle around the player where the CameraRig
is not moved. In the demo scene this is a cylinder at floor level.
Remember to turn of collisions.
· Additional Movement Multiplier(额外移动乘数):圈边缘的移动放大因数。0就是不移动CameraRig。值越高模拟的游玩区域就越大,但是也可能就越不令人舒适。
· Head Zone Radius(头部空间半径):游玩区不会发生移动的圆圈尺寸,一切都正常的。如果值太低,在蹲下时就会感到不舒服。