VRTK_ObjectControl
Overview
An abstract class to provide a mechanism to control an object based on controller input.
As this is an abstract class, it cannot be applied directly to a game object and performs no logic.
Inspector Parameters
- Controller: The controller to read the controller events from. If this is blank then it will attempt to get a controller events script from the same GameObject.
- Device For Direction: The direction that will be moved in is the direction of this device.
- Disable Other Controls On Active: If this is checked then whenever the axis on the attached controller is being changed, all other object control scripts of the same type on other controllers will be disabled.
- Affect On Falling: If a
VRTK_BodyPhysics
script is present and this is checked, then the object control will affect the play area whilst it is falling. - Control Override Object: An optional game object to apply the object control to. If this is blank then the PlayArea will be controlled.
Class Variables
public enum DirectionDevices
- Devices for providing direction.Headset
- The headset device.LeftController
- The left controller device.RightController
- The right controller device.ControlledObject
- The controlled object.
Class Events
XAxisChanged
- Emitted when the X Axis Changes.YAxisChanged
- Emitted when the Y Axis Changes.
Unity Events
Adding the VRTK_ObjectControl_UnityEvents
component to VRTK_ObjectControl
object allows access to UnityEvents
that will react identically to the Class Events.
OnXAxisChanged
- Emits the XAxisChanged class event.OnYAxisChanged
- Emits the YAxisChanged class event.
Event Payload
GameObject controlledGameObject
- The GameObject that is going to be affected.Transform directionDevice
- The device that is used for the direction.Vector3 axisDirection
- The axis that is being affected.Vector3 axis
- The value of the current touchpad touch point based across the axis direction.float deadzone
- The value of the deadzone based across the axis direction.bool currentlyFalling
- Whether the controlled GameObject is currently falling.bool modifierActive
- Whether the modifier button is pressed.
Updated less than a minute ago