`

Unreal Action Mapping and haptics feedback for Oculus Touch

阅读更多


  Touch 的原型研制开始于DK1时代,在位于拇指摇杆和食指开关上,还有中指的抓取键上,都装有能感应你手指的传感器,内置的传感器阵列跟踪手指自然社交动作,比如,伸食指指着某个地方,抓东西,挥舞以及竖大拇哥等姿势。在初步原型阶段,拇指和食指的动作是离散的(0 和 1),相对于HTC VIVE(灯塔定位系统可实现亚毫米级检测)和PS MOVE,Oculus Touch能更好地模拟人类手部的运动,比如手指姿态还原,震动反馈等

 

 

Button Touch State

 

In addition to buttons, Touch controllers can detect whether user fingers are touching some buttons or are in certain positions.

 

ovrTouch_A : User in touching A button on the right controller.
ovrTouch_B : User in touching B button on the right controller.
ovrTouch_RThumb : User has a finger on the thumb stick of the right controller.
ovrTouch_RThumbRest : User has a finger on the textured thumb rest of the right controller.
ovrTouch_RIndexTrigger : User in touching the index finger trigger on the right controller.
ovrTouch_X : User in touching X button on the left controller.
ovrTouch_Y : User in touching Y button on the left controller.
ovrTouch_LThumb : User has a finger on the thumb stick of the left controller.
ovrTouch_LThumbRest : User has a finger on the textured thumb rest of the left controller.
ovrTouch_LIndexTrigger : User in touching the index finger trigger on the left controller.
ovrTouch_RIndexPointing : Users right index finger is pointing forward past the trigger.
ovrTouch_RThumbUp : Users right thumb is up and away from buttons on the controller, a gesture that can be interpreted as right thumbs up.
ovrTouch_LIndexPointing : Users left index finger is pointing forward past the trigger.
ovrTouch_LThumbUp : Users left thumb is up and away from buttons on the controller, a gesture that can be interpreted as left thumbs up.

 

For UE4:

A == MotionController (R) FaceButton1

B == MotionController (R) FaceButton2

Y == MotionController (L) FaceButton2

X == MotionController (L) FaceButton1

 

Haptic Feedback

 

Oculus touch controllers can provide haptic feedback through vibration.The SDK supports two types of haptics: buffered and non-buffered. Buffered haptics are designed to change rapidly (every 3.125ms) and work well for subtle effects. Non-buffered haptics are designed for simple effects that don't change often (every 33ms).

Note: The buffered and non-buffered functions should not be used together, as they will result in unpredictable haptic feedback.

 

buffere-based haptics

Running at 320Hz, each sample is 3.125 milliseconds. Because these samples are added to a buffer that holds 256 samples, the buffer can hold up to 800 milliseconds of samples.

To check the status of the buffer, call ovr_GetControllerVibrationState:

ovr_GetControllerVibrationState(ovrSession session, ovrControllerType controllerType, ovrHapticsPlaybackState* outState);

 To submit to the buffer, call ovr_SubmitControllerVibration:

ovr_SubmitControllerVibration(ovrSession session, ovrControllerType controllerType, const ovrHapticsBuffer* buffer);

 The following code sample shows basic haptic submission as part of a game loop:

uint8_t amplitude = (uint8_t)round(handTrigger[t] * 255);

    result = ovr_GetControllerVibrationState(Session, touchController[t], &state);
    if (result != ovrSuccess || state.SamplesQueued >= kLowLatencyBufferSizeInSamples)
    {
        DefaultChannel.LogWarningF("%s Haptics skipped. Queue size %d", kTouchStr[t], state.SamplesQueued);
        continue;
    }

    for (int32_t i = 0; i < kLowLatencyBufferSizeInSamples; ++i)
        samples.push_back(amplitude);

    if (samples.size() > 0)
    {
        ovrHapticsBuffer buffer;
        buffer.SubmitMode = ovrHapticsBufferSubmit_Enqueue;
        buffer.SamplesCount = (uint32_t)samples.size();
        buffer.Samples = samples.data();
        result = ovr_SubmitControllerVibration(Session, touchController[t], &buffer);
        if (result != ovrSuccess)
        {
            // Something bad happened
            DefaultChannel.LogErrorF("%s: Haptics submit failed %d", kTouchStr[t], result);
        }
    }

 

non-buffered haptics

 

Vibration can be enabled by calling ovr_SetControllerVibration:

ovr_SetControllerVibration( Hmd, ovrControllerType_LTouch, freq, trigger);

 Vibration is enabled by specifying the frequency. Specifying 0.0f will vibrate at 160Hz. Specifying 1.0f will vibrate at 320Hz.

 

 For UE4:

Play a haptic feedback curve on the player's controller, Target is Player Controlle.

 

void APlayerController::PlayHapticEffect(UHapticFeedbackEffect_Base* HapticEffect, EControllerHand Hand, float Scale, bool bLoop)
{
	if (HapticEffect)
	{
		switch (Hand)
		{
		case EControllerHand::Left:
			ActiveHapticEffect_Left.Reset();
			ActiveHapticEffect_Left = MakeShareable(new FActiveHapticFeedbackEffect(HapticEffect, Scale, bLoop));
			break;
		case EControllerHand::Right:
			ActiveHapticEffect_Right.Reset();
			ActiveHapticEffect_Right = MakeShareable(new FActiveHapticFeedbackEffect(HapticEffect, Scale, bLoop));
			break;
		case EControllerHand::Gun:
			ActiveHapticEffect_Gun.Reset();
			ActiveHapticEffect_Gun = MakeShareable(new FActiveHapticFeedbackEffect(HapticEffect, Scale, bLoop));
		default:
			UE_LOG(LogPlayerController, Warning, TEXT("Invalid hand specified (%d) for haptic feedback effect %s"), (int32)Hand, *HapticEffect->GetName());
			break;
		}
	}
}

void APlayerController::StopHapticEffect(EControllerHand Hand)
{
	SetHapticsByValue(0.f, 0.f, Hand);
}

 

 

 

  • 大小: 344.2 KB
  • 大小: 2.3 MB
分享到:
评论

相关推荐

    Moniem - Unreal Engine Lighting and Rendering Essentials

    Moniem - Unreal Engine Lighting and Rendering EssentialsMoniem - Unreal Engine Lighting and Rendering EssentialsMoniem - Unreal Engine Lighting and Rendering Essentials

    cesium for unreal

    《Cesium for Unreal:在UE5中构建GIS应用的创新实践》 在现代游戏开发和虚拟现实领域,地理信息系统(GIS)的应用日益广泛。"cesium for unreal" 是一款专为Unreal Engine 5(简称UE5)设计的插件,它将Cesium的...

    Cesium For Unreal 1.22最新版本

    《Cesium for Unreal 1.22:解锁UE+GIS的新维度》 Cesium for Unreal 1.22是专为虚幻引擎(Unreal Engine)设计的一个强大的扩展工具,旨在将地理信息系统(GIS)的功能无缝集成到游戏开发和可视化应用中。这个最新...

    Unreal Engine Lighting and Rendering Essentials

    《Unreal Engine Lighting and Rendering Essentials》是一本专注于Unreal Engine 4(UE4)图形学、光照和材质系统的专业书籍。本书为读者提供了一个系统性学习UE4在这些领域知识的途径,覆盖了从基础概念到高级技术...

    3D Game Design with Unreal Engine 4 and Blender epub

    3D Game Design with Unreal Engine 4 and Blender 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除

    Exporter for Unreal to Unity 2024 Version:1.41

    资源仅供学习,如有需求,请在商店购买: https://assetstore.unity.com/packages/tools/integration/exporter-for-unreal-to-unity-193237

    Exporter for Unreal to Unity 2024 版本:1.40

    此软件仅供学习交流,禁止商用。 UE场景中的模型转Unity格式,在unitypackage包中包含一个压缩包(Unreal to Unity),将压缩包解压后导入UE中,具体教程b站有

    Unreal到Unity的导出器:Exporter for Unreal to Unity 2024 v1.41

    包括修复、新功能以及对2024年全年新虚幻引擎(Unreal Engine,简称UE)版本的支持 Unreal到Unity的导出器是一款强大的工具,可以帮助您在将Unreal Engine项目转换为Unity时节省时间和精力。它是一个Unreal插件(仅...

    Unreal Engine VR Cookbook: Developing Virtual Reality with UE4 - PDF

    For game developers and visualization specialists, VR is the next amazing frontier to conquer—and Unreal Engine 4 is the ideal platform to conquer it with. Unreal ? Engine VR Cookbook is your ...

    learning unreal engine game development

    engine is, specifically for Unreal Engine 4 and its history. You will get an overview of the features of Unreal Engine 4 and how it can help you to create a game. Chapter 2, Creating Your First Level,...

    Unreal Engine 4 for Design Visualization=DSIVAR

    Unreal Engine 4 for Design Visualization=Developing Stunning Interactive Visualizations, Animations, and Renderings

    Rider For Unreal.Engine 2021.1

    Rider For Unreal.Engine 2021.1 官网下载版

    V-Ray Next v4.30.22 For Unreal 4.23-24-25

    V-Ray Next v4.30.22 for Unreal 是一款专为Unreal Engine 4.23、4.24和4.25版本设计的高级渲染插件,旨在提升游戏场景的视觉质量和效率。这款插件由 Chaos Group 开发,Chaos Group 是在计算机图形学领域著名的渲染...

    Unreal Engine 4 for Beginners

    Unreal Engine 4 for Beginners, as its name implies, is specifically written with the beginner in mind. It is meant for those who wish to learn how to make video games with no prior game development, ...

    3D Game Design with Unreal Engine 4 and Blender

    《3D Game Design with Unreal Engine 4 and Blender》这本书由Justin Plowman撰写,旨在帮助读者通过结合使用强大的Unreal Engine 4 (UE4)和Blender来创建视觉上吸引人且内容丰富的游戏环境。 #### 二、Unreal ...

    arcgis-maps-sdk-unreal-engine-1.0.0.zip

    《ArcGIS Maps SDK for Unreal Engine 1.0.0:构建三维数字孪生世界的基石》 ArcGIS Maps SDK for Unreal Engine 1.0.0 是Esri公司为游戏引擎Unreal Engine开发的一款强大的地理信息系统(GIS)工具。这款开发包...

    3D Game Design with Unreal Engine 4 and Blender 无水印pdf

    3D Game Design with Unreal Engine 4 and Blender 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如...

    Unreal Engine 4 for Beginners 无水印pdf

    Unreal Engine 4 for Beginners 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传...

Global site tag (gtag.js) - Google Analytics