SteamVR/Environments/Advanced Interaction

From Valve Developer Community
Jump to: navigation, search

Advanced VR Interaction’s Using the point_value_remapper Entity

The point_value_remapper entity is used to create interactable objects and scenes for VR, it supports different types of interaction such as pulling, pushing and turning.

In this tutorial we will cover how to use the Source 2 entity point_value_remapper to add an interactable lever to your map.

The tutorial will aim to show you how to make a functioning lever that can be grabbed with your VR controller and give you the knowledge to design your own types of interactions by making use of this entity.
The point_value_remapper entity however, isn't restricted to levers, it can be used to create many different types of interactions and interactable objects.


Tip.pngTip:This tutorial assumes you already know the basics of using Hammer and have already completed the basic SteamVR Home tutorials. For a beginner's introduction to level design and the SteamVR Home tools, click here.


The point value remapper is a versatile and complex entity. In its most basic setup, it tracks the position of your VR controller in world-space, uses your controllers movement between two points and remaps this to a linear value. This value is used to control the playback of an animation on a specified output entity such as a prop_dynamic.

Icon-Bug.pngBug:Your second controller is ignored by this entity when the “requires use key” parameter is not checked.  [todo tested in?]


Tip.pngTip:Whilst this tutorial teaches you to use the point_value_remapper to control interactables and sync animations on props, you are not limited to use this entity in just this way. You could use the remapper to control any other type of movement you wish to track and remap.


Repairing Robots

Door handles like this one featured in Robot Repair are controlled by a point_value_remapper entity. As the player grabs the handle and pulls it downwards the door starts to open.

The point_value_remapper entity is used extensively in Valve’s Robot Repair VR experience included as part of “The Lab”. During Robot Repair when the player is asked to open the door and let Atlas through, the player has to interact with and pull down a big red lever. This lever’s functionality is created through the use of a point_value_remapper entity.

Another example of this entity in use during Robot Repair is when the player receives instructions to expose Atlas’s innards by removing his faceplate. This motion of pulling away his faceplate uses the point_value_remapper to track the players hand moving away from Atlas’s face.

Other examples of the point_value_remapper in Robot Repair are;

  • The Pocket Universe drawers that contain Bendies
  • The Aperture Science CCTV camera
  • The rotation of Atlas’s exposed innards


Types of Tracked Motion

To simplify explaining this entity, we are discussing its functionality as two separate types of tracked motion.


  • Linear Motion

The simplest application of this entity is to control linear motion. Linear motion is the movement of an object between two defined points. An easy way to understand this concept is to imagine the motion involved when pressing down a button. A typical mechanical (non touchscreen) button goes from fully unpressed to fully pressed.

As previously mentioned, this linear movement consists of two points. The first point we would want to track motion from is the location of the button fully unpressed. The second position would be the resting place of the button when it is fully pressed. The physical point to point movement your hand makes when performing this motion is captured and remapped by the entity to a percentage 0 - 1, the entity will then use this percentage to sync an animation’s playback to the movement of your controller. As your controller moves from the point representing the unpressed button to the point representing the fully pressed button, the entity will in parallel control the playback of animation on a specified prop. This makes the prop’s animation visually match your physical pressing of the button.

Tip.pngTip: To enable Linear motion you should set “Input type” on your point_value_remapper entity to “Player Shoot Position”.


  • Circular Motion

This entity also has the ability to simulate circular motion. Circular motion is the movement of one point around the axis of another. One way of visualising this is to imagine the circular motion you would make to turn the handle of a music box. The central point (or axis) is stationary and your circular hand action enables the handle to rotate around it.

To setup the point value remapper to track circular type motion, an axis must be defined that you wish to orbit around. To do this you first create a point at the objects desired center of rotation. Secondly to complete the creation of the axis, you place the second point away from the first to designate a direction. The vector you have just created will be the axis in which rotational motion is tracked.

Tip.pngTip: To enable Circular motion you should set “Input type” on your point_value_remapper entity to “Player Shoot Position around Axis”.




Getting Started

After following this tutorial your scene should look like this and contain one point_value_remapper, one prop_dynamic and two info_targets.

Follow these instructions to setup the entities required to make a functional point value remapper: The first thing we need to do is create a prop whos animations will be controlled by the point_value_remapper entity. Its useful to place this prop first as its position will be useful when positioning the following entities.

  • Place a prop_dynamic in your level
  • Name the prop door_prop
  • Set the prop_dynamic’s world model to aperture/models/door_robot_entrance.vmdl
  • Set the default animation to door_open_combined
  • Tick the box hold animation so that the animation doesn't auto loop


Placing the Interaction Targets

Info_target entities are used to represent the location of the two points our point_value_remapper will track. We need to create one point for where controller tracking will start and one for where we want it to end. In this case we want our points to be at the start and finish of the levers animation, the lever animates at a 90 degrees right angle.

  • Place one Info_target at the top point of our doors lever (the position the lever is in by default)
  • Name this point lever_start_position
  • Place the second Info_target where the lever will end up once the animation finishes.
  • Name this point lever_end_position
Tip.pngTip: To make it easier to line up the second Info_target you can preview the animation in Hammer by pressing the animation in editor toggle……… this will play the animation making it easier to position the info_target at the correct location.


Creating the Point Value Remapper

Now we need to create the actual point_value_remapper entity that will control our interaction and sync our props animation.

  • Place a point_value_remapper entity in your map.
  • Input Position should be set to Player Shoot Position ( for linear motion )
  • Change remap line start to the name of our first info_target
  • Change remap line end to the name of our second info_target
  • Set Mat Interp Change Per Second to 2.0
  • Set Disengage Max Distance to 20.0
  • Set Engage Distance to 15.0
  • Set Require Use Key to yes
  • Output Type should be set to Animation Cycle
  • Set Output Entity to the name of our door prop
  • Set Momentum Type to Spring Toward Snap Value
  • Set Momentum Modifier to 0.2
  • If you wish you can also assign your own engage and Disengage sounds
  • Make sure the animations playback rate is set to 0 fps


Compile and test your map, you should now be able to successfully open the door.

Additional Parameters

Stub

This article or section is a stub. You can help by adding to it.

Below is a description of the different options that are available to edit in the point_value_remapper entities object properties.

  • Haptics Type
Currently this option only allows you to enable haptic pulses or disable haptics completely.
  • Momentum Type
1 : Friction
[Todo]
2 : Spring Toward Snap Value
Once you’ve started the interaction the animation will continue to move towards the specified Snap Value, even once input has been disengaged.
3 : Spring Away From Snap Value
The opposite of Spring towards Snap Value, this momentum type will start to move your animation backwards away from the Snap Value.
  • Momentum Modifier

How much additional momentum to add to existing momentum.

  • Snap Value
A snap value can be set to snap the animation to a desired point whilst in motion, a momentum type that supports snapping must be enabled.
  • Ratchet Type
Absolute
[Todo]
Each Engauge
[Todo]
  • Input Offset
[Todo]


Tip.pngTip: Did you know that blue highlighted parameters in the object properties box represent user modified values and grey text represents the entities default values?.