Skip to main content

Guide

Using our Unreal SDK Plugin, you can implement the haptic into your content made with Unreal.

  1. Import SDK Plugin
  2. Link the Haptic App
  3. Add Prefab to Initialize
  4. (Optional) Prepare for C++

Prerequisite​

Before we start, make sure you have a haptic application(haptic app, for short) corresponding to your game, and the haptic app should contain at least one haptic event. By following this guide, You will link the haptic app to your game.

note

You can create and manage haptic apps in Portal, a web-based program. If you don't know about haptic app or don't have one, please visit Portal first and make your own haptic app. (Protip: Use template to make the app quickly)

Slide 16_9 - 9.png

Link process requires App ID and API Key which can be browsed in Portal. Go to your haptic app in Portal, move to "Settings" tab, and prepare App ID and API Key.

note

There is no API Key until you create it. Navigate to the "API Key" tab and click the "New" button to generate one.

Import SDK Plugin​

  1. Get bHaptics Plugin from Unreal Marketplace.

    bHapticsPlugin in Code Plugins - UE Marketplace - Chrome 2024-04-29 μ˜€ν›„ 5_14_01.png

  2. Install plugin to engine.

    Untitled

    Untitled

    1. Go to Epic Games Launcher.
    2. At the left, Select "Unreal Engine" tab.
    3. At the top, Select "Library" tab.
    4. Find bHapticsPlugin in the list, and press "Install to Engine".
    5. Select your game engine version.
note

For more information about plugin in Unreal, visit official Unreal Documentation.

  1. Activate the plugin.
    1. Open the Unreal project which you want to use bHaptics.

    2. Open the Plugins window.

      Slide 16_9 - 10.png

      1. In the toolbar, select "Settings".
      2. In the dropdown, select "Plugins". Then the Plugins window will appear.
    3. Activate "BhapticsPlugin".

      Frame 79.png

      1. Search "bhaptics".
      2. Check "BhapticsPlugin" to activate.
      3. The warning will appear. Press "Restart Now". (Make sure you save your project first if you have any changes!)
  1. Open the Project Settings.

  2. Go to bHaptics plugin settings.

    Untitled

  3. Put the App ID, API Key of your haptic app, and press "Link bHaptics" button. App ID and API key can be found in Portal.

  4. If the project is successfully synchronized with bHaptics Developer portal, you will receive following message BHAPTICS_SETTINGS_SUCCESS.

    Untitled

Set Haptic Environment​

Before using haptic-related functions, you must initialize the haptic environment. The initialization should be made at the beginning of the game. Also, you should destroy the haptic environment when the game is ended.

We provide both Blueprint and C++ methods for these functionalities.

  • Blueprint
    • Initalize: Call "Initialize bHaptics" Node
    • Destroy: Call "Destroy bHaptics" Node
  • C++
    • Initalize: Invoke BhapticsSDK2::Initialize() Function
    • Destroy: Invoke BhapticsSDK2::Destroy() Function

Also, you must notice that:

  • You can initialize multiple times. This will not cause any efficiency problem.
  • You must destroy only ONCE at the final level where program ends. It might causes crashes if you destroy more than once.

We offer two options. Feel free to choose the one that suits your needs.

  • Via GameInstance (Recommended)
  • Via Level Blueprint

Via GameInstance​

TheΒ game instanceΒ is instantiated on engine launch and remains active until the engine shuts down.

"Gameplay Framework" β€” Unreal Documentation

  1. Create new Blueprint Class inherit from "GameInstance".

    Untitled

  2. Name it as you want, and open its Event Graph.

    Untitled

  3. Setup the Event Graph, and compile/save.

    Untitled

    • Initialize: Connect "Initialize bHaptics" after "Event Init".
    • Destroy: Connect "Destroy bHaptics" after "Event Shutdown"
  4. Go to Project Settings β†’ Project β†’ Maps & Modes, and set Game Instance Class as what you've just made.

    Untitled

Via Level Blueprint​

  1. Open the Level Blueprint

    Frame 80.png

  2. Setup the Event Graph, and compile/save.

    Untitled

    • Initialize: Connect "Initialize bHaptics" after "Event BeginPlay".
    • Destroy: Connect "Destroy bHaptics" after "Event End Play"

(Optional) Prepare for C++​

If you're using C++ in your Unreal project, there are some additional required processes.

  1. Move to Source\[YourGameName]\[YourGameName].Build.cs and add dependency.

    // Add Dependency

    PrivateDependencyModuleNames.Add("BhapticsPlugin");

    // Or Using AddRange

    PrivateDependencyModuleNames.AddRange(new string[] { "BhapticsPlugin" });
  2. Include "BhapticsSDK2.h" header in your C++ script which uses the haptic features.

    #include "CppGameModeBase.h"
    #include "BhapticsSDK2.h"

    void CppGameModeBase::BeginPlay()
    {
    Super::BeginPlay();

    UBhapticsSDK2::Initialize();
    }

Further Reading​

You're now ready to use the bHaptics haptic feature! Visit our Unreal Reference page to play haptics in your game.

Troubleshooting​

If you can't find the module, please refer to this page.