Files
Plugin/Source/SenseGloveKismet/Public/SGKismet/SGHapticsComponentKismetLibrary.h
T

199 lines
8.3 KiB
C++

/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2026 SenseGlove
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @section DESCRIPTION
*
*
*/
#pragma once
#include "SGKismet/SGBlueprintFunctionLibrary.h"
#include "SGHapticsComponentKismetLibrary.generated.h"
class AActor;
class USGCustomWaveform;
class USGHapticsComponent;
UCLASS(meta=(ScriptName = "SenseGloveHapticsComponentKismetLibrary"))
class SENSEGLOVEKISMET_API UHapticsComponentKismetLibrary final : public USGBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Haptics Component")
static bool IsLeft(const USGHapticsComponent* HapticsComponent);
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Haptics Component")
static bool IsRight(const USGHapticsComponent* HapticsComponent);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Haptics Component")
static void SetRight(UPARAM(ref) USGHapticsComponent* HapticsComponent, bool bInRight);
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Haptics Component")
static bool AutoStopsAllHaptics(const USGHapticsComponent* HapticsComponent);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Haptics Component")
static void SetAutoStopAllHaptics(UPARAM(ref) USGHapticsComponent* HapticsComponent, bool bInAutoStopAllHaptics);
/**
* Stops all Haptic effects if any are currently playing. Useful at the end of simulations or when restarting the
* level.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Haptics Component")
static void StopHaptics(UPARAM(ref) USGHapticsComponent* HapticsComponent);
/**
* Stops only vibrations.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Haptics Component")
static void StopVibrations(UPARAM(ref) USGHapticsComponent* HapticsComponent);
/**
* Take all active commands in the device queue, compile them into one and send them to the device.
*
* @return Returns true if the message was successfully sent to SenseCom.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Haptics Component")
static bool SendHaptics(UPARAM(ref) USGHapticsComponent* HapticsComponent);
/**
* Returns true if the haptic glove supports vibration feedback at the specified location.
*
* @param AtLocation
*/
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Haptics Component")
static bool SupportsCustomWaveform(const USGHapticsComponent* HapticsComponent,
ESGHapticLocation AtLocation);
/**
* Sends a custom waveform to the location specified, provided that the glove has a motor there, and can support
* custom waveforms.
*
* @param OutWaveform
* @param Location
*/
static bool SendCustomWaveform(UPARAM(ref) USGHapticsComponent* HapticsComponent,
USGCustomWaveform* OutWaveform, ESGHapticLocation Location);
/**
* Sends a custom waveform to the location specified, provided that the glove has a motor there, and can support
* custom waveforms.
*
* @param Amplitude
* @param Duration
* @param Location
*/
UFUNCTION(BlueprintCallable, DisplayName="Send Custom Waveform",
Category="SenseGlove | Components | Haptics Component")
static bool SendCustomWaveform_Amplitude_Duration_Location(
UPARAM(ref) USGHapticsComponent* HapticsComponent,
float Amplitude, float Duration, ESGHapticLocation Location);
/**
* Sends a custom waveform to the location specified, provided that the glove has a motor there, and can support
* custom waveforms.
*
* @param Amplitude
* @param Duration
* @param Frequency
* @param Location
*/
UFUNCTION(BlueprintCallable, DisplayName="Send Custom Waveform",
Category="SenseGlove | Components | Haptics Component")
static bool SendCustomWaveform_Amplitude_Duration_Frequency_Location(
UPARAM(ref) USGHapticsComponent* HapticsComponent,
float Amplitude, float Duration, float Frequency, ESGHapticLocation Location);
/**
* Queue a list of force-feedback levels, between 0.0f and 1.0f. Your list should be sorted from thumb to pinky.
*
* @param Levels01 Array containing the Force-Feedback levels, from 0.0f (no FFB) to 1.0f. A value < 0.0f will be
* ignored.
*
* @remarks Devices that 'only' have on/off FFB will treat any value > 0.0 as 1.0.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Haptics Component")
static bool QueueForceFeedbackLevels(UPARAM(ref) USGHapticsComponent* HapticsComponent,
const TArray<float>& Levels01);
/**
* Set the Force-Feedback value of a particular finger to a specific level </summary>
*
* @param Level01 Value will be clamped between [0...1], where 0.0f means no Force-Feedback, and 1.0 means full
* force-feedback.
* @param Finger The finger to which to send the command.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Haptics Component")
static bool QueueForceFeedbackLevel(UPARAM(ref) USGHapticsComponent* HapticsComponent,
int32 Finger, float Level01);
/**
* Queue a list of vibration levels, between 0.0 and 1.0. Your list should be sorted from thumb to pinky.
*
* @param Levels01 Array containing the vibration levels, from 0.0 (no vibration) to 1.0. A value < 0.0f will be
* ignored.
*
* @remarks Devices that 'only' have on/off FFB will treat any value > 0.0 as 1.0.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Haptics Component")
static bool QueueVibroLevels(UPARAM(ref) USGHapticsComponent* HapticsComponent,
const TArray<float>& Levels01);
/**
* Queue a command to set the (continuous) vibration level at a specific location to a set amplitude.
*
* @param Location
* @param Level01 Value will be clamped between [0...1], where 0.0f means no vibration, and 1.0 means full
* vibration.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Haptics Component")
static bool QueueVibroLevel(UPARAM(ref) USGHapticsComponent* HapticsComponent,
ESGHapticLocation Location, float Level01);
/**
* Returns true if the chosen glove supports active contact feedback on the Wrist.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Haptics Component")
static bool SupportsWristSqueeze(const USGHapticsComponent* HapticsComponent);
/**
* Queue a command to set the amount of squeeze level (a.k.a. squeeze-feedback) to the desired level
* (0 = no squeeze, 1 = full squeeze) on the wrist, and optionally send it right away.
*
* @param SqueezeLevel01
* @param bSendImmediate
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Haptics Component")
static bool QueueWristSqueeze(UPARAM(ref) USGHapticsComponent* HapticsComponent,
float SqueezeLevel01, bool bSendImmediate);
};