Skip to content

Haptics Improvements

Craig McDonald requested to merge feature/haptics-improvements into devel

Description

This includes various minor improvements to the haptic objects, based on the what was needed to implement haptic resistance in burt games.

  • Haptic Wall has a stiffness property that is set, instead of "strength", so that we can stick to real physical units.
  • The "dimensionality" of haptic objects (which just applies to the output force) is now handled by the base class, so calculations of the output force in all the child classes now looks simpler.
  • The "EnableBehavior" was made more complex so that it could store different variables independently: whether or not we're using ramping, whether or not the object will jump to completely enabled/disabled if we're not interacting with it (snapping), and whether or not the ramp will reset to a value (0 or 1) when starting to enable/disable.
  • The rate at which the haptic objects ramp on/off can now be set externally. Note: It might be a little confusing, but the way I made it EnableBehavior contains two "Behaviors", one for enabling and one for disabling. The two Behaviors can be the same or different, which I do make use of.
  • I cleaned up the way the HapticObject class implements the different enable/disable behaviors to make the code a little simpler, but those changes are not intended to affect the function.
  • I wanted to overload the equality operator for the Dimensionality in HapticTypes, and that required a long chunk of code that's standard for C# (https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/statements-expressions-operators/how-to-define-value-equality-for-a-type). Similarly, for convenience I added a bunch of public static properties for Dimensionality and EnableBehavior that are constructors that are compact to write. E.g. Dimensionality.X, EnableBehavior.Soft

Updates to the HapticObjectTest are just to demonstrate that the changes above didn't break anything, and to better demonstrate the new choices for enable behavior.

Also made some changes to the haptic changing sphere so that the radius of the sphere could be specified directly as an input to the Update function, which was needed to implement haptic guidance in flying eagle. Changes to HapticGuideToTarget are just to test the manual radius Update.

Added xml documentation to build output, so documentation will show up when using this library in other projects.

What to focus on

  • Use the haptic object test to ensure that nothing about the haptic objects feels different. Toggle through the different "enable behaviors."
  • Test HapticGuideToTarget with manual radius
Edited by Craig McDonald

Merge request reports

Loading