Guides
Guides

VRTK_ArtificialPusher

extends VRTK_BaseControllable

Overview

An artificially simulated pushable pusher.

Required Components:

  • Collider - A Unity Collider to determine when an interaction has occured. Can be a compound collider set in child GameObjects. Will be automatically added at runtime.

Script Usage:

  • Place the VRTK_ArtificialPusher script onto the GameObject that is to become the pusher.

Inspector Parameters

  • Pressed Distance: The distance along the Operate Axis until the pusher reaches the pressed position.
  • Min Max Limit Threshold: The threshold in which the pusher's current normalized position along the Operate Axis has to be within the minimum and maximum limits of the pusher.
  • Resting Position: The normalized position of the pusher between the original position and the pressed position that will be considered as the resting position for the pusher.
  • Resting Position Threshold: The normalized value that the pusher can be from the Resting Position before the pusher is considered to be resting when not being interacted with.
  • Press Speed: The speed in which the pusher moves towards to the Pressed Distance position.
  • Return Speed: The speed in which the pusher will return to the Target Position of the pusher.

Class Methods

GetValue/0

public override float GetValue()

  • Parameters
    • none
  • Returns
    • float - The actual position of the pusher.

The GetValue method returns the current position value of the pusher.

GetNormalizedValue/0

public override float GetNormalizedValue()

  • Parameters
    • none
  • Returns
    • float - The normalized position of the pusher.

The GetNormalizedValue method returns the current position value of the pusher normalized between 0f and 1f.

SetValue/1

public override void SetValue(float value)

  • Parameters
    • float value - Not used.
  • Returns
    • none

The SetValue method is not implemented as the pusher resets automatically.

IsResting/0

public override bool IsResting()

  • Parameters
    • none
  • Returns
    • bool - Returns true if the pusher is currently at the resting position.

The IsResting method returns whether the pusher is currently at it's resting position.

SetStayPressed/1

public virtual void SetStayPressed(bool state)

  • Parameters
    • bool state - The state to set the Stay Pressed parameter to.
  • Returns
    • none

The SetStayPressed method sets the Stay Pressed parameter to the given state and if the state is false and the pusher is currently pressed then it is reset to the original position.

SetPositionTarget/1

public virtual void SetPositionTarget(float normalizedTarget)

  • Parameters
    • float normalizedTarget - The Position Target to set the pusher to between 0f and 1f.
  • Returns
    • none

The SetPositionTarget method sets the Position Target parameter to the given normalized value.