Home Search

DriveWorks Pro 21
Raycast

Send Feedback

Raycast (Beta)

This feature is currently in Beta due to the technology that it uses. This functionality makes use of WebXR or WebVR depending on browser version. These browser features are not yet widely supported. Check WebXR and WebVR support for more information.

The Raycast entity lets you add an input method to a Node in a DriveWorks 3D scene. The Raycast entity will cast (fire) a ray in the Z axis direction. This ray can interact with models that contain a Click Macro entity and will run a Specification Macro. The main purpose of this entity is to add interactive capabilities to a Node or controller in VR. This means you can use a gamepad controller to click on an object in a 3D environment.

The Raycast entity can be combined with the VR Camera and XR Orientation entity to create a virtual reality experience inside DriveWorks 3D. XR Orientation will provide the position and movement data for a VR headset or for the controllers that come with the device. Raycast provides interactive capabilities with other models in a 3D scene.

Supported Devices

List of devices that currently work with XR:

DeviceBrowserAPI
Oculus QuestOculus Browser (native)WebXR & WebVR (Soon to be deprecated)
Chrome AndroidChrome (Version 79+)WebXR
HTC ViveFirefox DesktopWebVR (Soon to be deprecated)

Please note, in the case of WebVR, as browsers update and change this feature may be deprecated.

Information Panel

With a Node selected and the Raycast entity added to the Node, the following will be displayed in the Information Panel:

Gamepad Button Ids

Gamepad Button Ids is used to show which buttons on the controller should activate the Raycast. These are provided as Ids and can be listed. In the example above we have listed button 0 and button 1 as the activation Ids for this Raycast.

Gamepad Hand

Select a device to take the input from. This can be one of three options - "Both", "Left" or "Right".

  • Both - This will take the input from the Left and Right gamepads or controllers that are being used.
  • Left - This is the left hand controller that you may be using for VR.
  • Right - This is the right hand controller that you may be using for VR.

Using the Raycast entity

Using the Raycast entity is straight forward. To make it work, you need to create a Node structure that can be used inside VR. The Raycast entity will be attached to the controller Node. You will point the controller at objects and cast (fire) a ray to select the object. You will need to use the Raycast entity along with the VR Camera entity and the XR Orientation entity. The XR Orientation entity provides the movement, the VR Camera provides the image and Raycast will provide a click interaction.

The resulting Node structure looks like the following:

image showing vr node structure

The Raycast entity has been added to a Node under the Left Hand Node. The Left Hand Node provides the movement and the Raycast is added to a model Node underneath. The model can be anything you desire but you have to make sure that the Raycast does hit the model itself. For example if the models origin is outside of its own geometry then the ray could hit the model. Ensure that the Node is beyond the model or add another Node that has the Raycast entity enabled.

The XR Orientation entity can take one of three values. These are headset, left or right. Headset is the head mounted VR display orientation, left is the left hand controller orientation and right is the right hand controller orientation.

The Raycast entity is also straight forward to set up. Each Raycast entity takes a button Id or a list of button Ids. In most circumstances you can just enter 0|1 into the Gamepad Button Ids property on the Raycast entity. This will cause the Raycast to trigger when the buttons with Ids 0 and 1 are pressed.

The hand model can be simple cubes or more complex models if you want to add them to your 3D scene. These are to identify where the users hands are and the direction they are facing.

Lastly, ensure that the Enable VR property on the 3D Preview Control is set to TRUE. This enables the VR button on the control. This button lets you enter a VR mode when visiting a DriveWorks Live website in a browser.