XRSPACE Developer Console

Component - XRHandRaycaster

Prefab description

This script provides Raycast position and direction for XRInputModule.

../_images/Component-XRHandRaycaster.png

There are some options for developers to set:

UseRaycaster: This option is to decide whether to cast a ray in runtime.

  • Common

    • RaycasterSide: The actual hand is right han or left hand. Can choose RIGHT, LEFT and NONE.

    • EventCamera: The camera to handle the UI event.

    • PhysicRaycaster: The physic raycaster for hand.

    • HandCollider: The collider on hand.

    • Ignore Physics Raycaster: If set false, 3D object will not recieve IEventSystemHandler.

    • Head: Current Head Gameobject.

  • Hand

    • IndexPoint: Index finger’s tip. This transform is index finger relative to plam’s position. It is constant.

    • Knuckle: Middle finger’s knuckle . This transform is current middle finger’s knuckle transform. It will follow index finger.

    • HeadDownwardOffset: The pivot offset relative to head y axis. Defult value is 0.2, it’s means 20cm.

    • HeadSideOffset: The pivot offset relative to head x axis. Defult value is 0.12, it’s means 12cm.

    • FollowingDis: Raycsater will follow the stable point when move over the current distance, defult value is 0.1.

    • VerticleWeight: The weight of raycaster direction move up and down. Defult value is 0.6, maximum is 1, minimum is 0.

    • HorizonWeight: The weight of raycaster direction move left and rigth. Defult value is 0.3, maximum is 1, minimum is 0.

  • Priority

    User can set the priority of each raycaster. Set -1 will ignore raycaster.

    • UITouch

    • UIRaycaster

    • ObjectRaycaster

    • Teleport

  • UI Touch

    • UITouchMask: Decide which layer will be touched. Ex: UI etc.

    • TouchColliderRadius: The Radius of Collider on index tip. Defult value is 0.01.

    • FocusDis: Distance of Focus. Defult value is 0.2.

  • UIDistance

    • UIRaycasterMask: Decide which layer will be hit.

    • DragThresholdMin: The min distance of drag threshold. Defult value is 0.

    • DragThresholdCoeff: The coefficient is used to multiply the original range to get the distant range. Defult value is 0.05.

    • DragScaleCoeff: The coeff of drag scale. Defult value is 1.

../_images/DescriptionDragThreshold.png
  • Object

    • ObjectMask: Decide which layer will be hit. Defult value is Obstacle.

    • ObjectRayMaxDistance: The max distance of physic raycaster and collider.Defult value is 10.

    • CastRadius: The radius of raycast.(The schematics id as follows.) Defult value is 0.005.

../_images/DescriptionCastRadius.png
  • Teleport

    • ValidTerrianMask: Decide which layer of terrian can teleport.

    • InValidTerrianMask: Decide which layer of terrain can’t teleport.

    • BlockMask: Teleport will be blocked by the layer of block mask.

    • ObstacleMask: Decide which layer is obstacle.

    • TPMaxDistance: The max distance of teleport. Defult value is 10.

    • MaxAngle: The angle of hand and head which make teleport to max distance. Defult value is 80.

    • MinAngle: The angle of hand and head which make teleport to min distance. Defult value is 10.

    • FlexibleAngle: There have the flexible space when the angle of user’s hand and body is max, it can let user keep teleport to farthest place. Defult value is 20.


Principle description

The stable point will initialize when user’s hand first time show in the FOV.

../_images/DescriptionFollowingDis.png

When the distance between hand and stable point larger than FollowingDis that user setting, the stable point will move toward to the hand and hold the distance with FollowingDis.

And here will show how to calculate the raycaster’s vector as below.

  • Peremeter VerticalWeight: α1

  • Peremeter HorizonWeight: α2

The raycaster’s vector is (XVFinal, YVFinal, ZVFinal).

  • XVFinal

    XVFinal= α1 * XVHand + ( 1-α1 ) * XVStable

  • YVFinal

    YVFinal= α2 * YVHand + ( 1-α2 ) * YVStable

  • ZVFinal

    ZVFinal= α1 * ZVHand + ( 1-α1 ) * ZVStable