5.5 C
New York
Saturday, March 15, 2025

enter – Translating Meta’s .haptics file frequency and amplitude to Unity’s left and proper motor power


Meta has an software known as Meta Haptics Studio that permits you to create detailed haptic timeseries information. It outputs this information within the following format as amplitude and frequency info:

  "alerts": {
    "steady": {
      "envelopes": {
        "amplitude": [
          {
            "time": 0,
            "amplitude": 0.0006520151
          },
          ...
        ],
        "frequency": [
          {
            "time": 0,
            "frequency": 0.7441585
          },
          ...
        ]
      }
    }
  }

In Unity, if you wish to make a sport that vibrates a gamepad, the API you must work with is:

Gamepad.present.SetMotorSpeeds(0.2f, 0.3f);

These two numbers are normalized (from 0 to 1) power values for the left (low-frequency)
motor and proper (high-frequency) motor in a gamepad respectively.

I would like to put in writing an algorithm that interprets the frequency and amplitude information in a significant strategy to timeseries info to set the left and proper motor power to.

The one drawback is that I do not know something about sign processing.

There already exists some code, written in Rust, that isn’t optimum. Here is what they are saying:

The algorithm we use to transform from .haptic to a GamepadRumble is a
bit foolish and would not make a lot sense:

  • The amplitude envelope is used because the motor speeds of the low
    frequency motor. The upper the amplitude of a breakpoint, the upper
    the motor pace.
  • The frequency envelope is used because the motor speeds of
    the excessive frequency motor. The upper the frequency of a breakpoint,
    the upper the motor pace. We use this algorithm solely as a result of we
    did not need to make investments time in developing with a greater algorithm, and
    as a result of it is the algorithm utilized by Good Vibrations 3.9.

I’ve no means of evaluating this algorithm, however they are saying it is no good. Can anybody suggest a unique means to do that? I’ve lots of programming expertise so I can translate english into code if somebody can describe a greater means to do that.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles