HTP Medium Level
Contents
Medium Level Concepts
Using the medium level when working with the HTP Toolkit, the users have a set of predefined tools that allows them to quickly create haptic applications. By default, the medium level does not require enabling. However, because it can be combined with the high level, if the user desires to exclusively use the medium level, he/she may change the weight corresponding to widgets to 0 (advanced tutorial), or may disable hit testing.
Haptic Behaviors
The medium level introduces the concept of haptic behaviors, which are a set of predefined ways in which an HTP can react to a user's input. Behaviors consider the current pressure, height, friction and in some cases even the current tick of the processor to determine a new height or friction value. Each behavior contains an associated parameter that can be adjusted (from 0 to 1), and also inverted when activating the invert flag. An HTP can have more than one behavior associated with it, and a behavior may be given a certain weight. Next, we explore the different kinds of haptic behaviors.
Note that behaviors can be added to the list of height behaviors or friction behaviors. Also note that the medium level activates haptic behaviors while the puck is placed on the table and deactivated while up/away.
Intensity Behavior
Associated Parameter: Intensity The intensity behavior takes in a value from 0 to 1 and sets the height to that value. This behavior is particularly useful to simulate the low level behavior in the medium level to manually set height/friction. The name of this behavior comes from the main purpose, however, which is looking at intensity values of pixels in an image and setting the height to that value.
Softness Behavior
Associated Parameter: Softness The softness behavior takes in a value from 0 to 1 and sets the softness of the rod to either hard or soft (respectively).
Oscillation Behavior
Associated Parameter: Frequency The oscillation behavior takes in a value from 0 to 1 and sets the frequency in which the rod oscillates (0 no oscillation, 1 very fast oscillation).
Breaky Behavior
Associated Parameter: Number of Breakpoints The breaky behavior represents a behavior in which the pressure applied by the user has certain breakpoints in which the puck creates some resistance to simulate granularity. The number of breakpoints ranges from 0 to 10 (0 being no breakpoints and 1.0 representing 10 breakpoints).
Programming with the Medium Level
Programming with the medium level is much easier than the low level and it's very fun and easy. As soon as a behavior is created and associated to an HTP, it will work that way.
Basic Example
The following example shows an HTP that changes heights depending on the pressure applied.
- HTPManager manager = m.Instance);
- HTP h = manager.GetHTP(0xEF);
Example Using Multiple Behaviors with Varying Weights
The following example combines oscillation and softness behaviors together.