如何在Unity里使用OptiTrack定位数据

如何在Unity里使用OptiTrack定位数据

一、下载软件和插件

登录Optitrack官网
http://www.optitrack.com.cn/downloads/motive.html

1、下载Motive软件:

在这里插入图片描述

2、下载Unity插件:

在这里插入图片描述

二、安装Motive

1、Motive软件使用需要安装两个驱动,这个只需要在安装Motive时连上互联网就会自动安装了。

3、软件使用需要加密狗,记得把加密狗插到电脑

4、使用定位自少要两个镜头,把镜头安装好之后,用交换机连接到电脑

5、校准扫场
选中对应型号的校准杆,点击Start Wanding。然后开始用校准杆扫场,扫到2000以上后,点击计算(Calculate),如果数据为绿色,点击应用,如果数据红色就重新校准。
在这里插入图片描述
6、校准地面坐标
把三角架放到地面,三角架的方向(短边为X轴,长边为Z轴)就是Motive里场景的坐标方向,点击Set Ground Plane。
在这里插入图片描述
7、创建刚体
(1)把三个以上的反光球组成一组绑定在物体上(头显、手柄),放在Optitrack镜头可见的位置,调整好方向(比如头显的正前方是Z轴正前方,头显放置时,头显前方就指向三角架Z轴(长边))。
在这里插入图片描述
(2)把物体放置好后,在Motive里框选物体上所有的光点,然后创建刚体。
刚体可以根据需要改名字,和ID。这里这个ID非常重要,把刚体的定位数据传输出去需要使用。
Active选上后才可以传输数据。
在这里插入图片描述
8、打开流数据
在这里插入图片描述

三、在Unity里导入插件

1、导入在官网下载的插件,添加连接Motive的脚本OptitrackStreamingClient:
把在官网下载的插件导入Unity工程
如果是本地链接,脚本的参数用默认的就行。
在这里插入图片描述
2、在对应物体上添加同步Motive刚体位置信息的脚本OptitrackRigidBody:
在这里插入图片描述
3、给相机添加OptitrackHmd脚本:
在这里插入图片描述
4、注意:RigidBody Id要和Motive那边的刚体ID对应。

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
-------------------- FairyGUI Copyright © 2014-2020 FairyGUI.com Version 3.4.0 support@fairygui.com -------------------- FairyGUI is a flexible UI framework for Unity, working with the professional FREE Game UI Editor: FairyGUI Editor. Download the editor from here: http://en.fairygui.com/ -------------------- Get Started -------------------- Run demos in Assets/FairyGUI/Examples/Scenes. The UI project is in Examples-UIProject.zip, unzip it anywhere. Use FairyGUI Editor to open it. Using FairyGUI in Unity: * Place a UIPanel in scene by using editor menu GameObject/FairyGUI/UIPanel. * Or using UIPackage.CreateObject to create UI component dynamically, and then use GRoot.inst.AddChild to show it on screen. ----------------- Version History ----------------- 3.4.0 - NEW: Add multi-display support. - NEW: Add API DynamicFont(name, font). - IMPROVED: Compatibility with 2018.3. - FIXED: Incorrect letter spacing on mobile platform. - FIXED: Same transition hook may be called twice. - FIXED: Exception raised when texture was disposed before object was disposed. 3.3.0 - NEW: Add textfield maxwidth feature. - NEW: Add API to query package dependencies. - IMPROVED: Graphics module refactor. Now it is more convenient to create various shapes(pie, lines, polygon etc) and do mesh deform. Memory usage on building mesh is also dropped. Also supports automatically setup uv for arbitrary quad to avoid seam between 2 triangles. All shaders are updated, don't forget to replace shaders in your project. - IMPROVED: Text-Brighter mechanism is removed, so FairyGUI-Text-Brighter.shader is removed. - IMPROVED: Add support for shrinking multi-line text. - IMPROVED: Improve Lua support. 3.2.0 - NEW: Add DisplayObjectInfo component. Define script symbol FAIRYGUI_TEST to enable it. - FIXED: A virtual list scrolling bug. - FIXED: A BlendMode bug. 3.1.0 - NEW: Draw extra 8 directions instead of 4 directions to archive text outline effect. Toggle option is UIConfig.enhancedTextOutlineEffect. - IMPROVED: Eexecution efficiency optimizations. - IMPROVED: GoWrapper now supports multiple materials. - FIXED: Correct cleanup action for RemovePackage. 3.0.0 From this version, we change package data format to binary. Editor version 3.9.0 with 'binary format' option checked in publish dialog is required to generating this kind of format. Old XML format is not supported anymore. - NEW: Add UIPackage.UnloadAssets and UIPackage.ReloadAssets to allow unload package resources without removing the package. - NEW: Add TransitionActionType.Text and TransitionActionType.Icon. 2.4.0 - NEW: GTween is introduced, DOTween is no longer used inside FairyGUI. - NEW: Transitions now support playing partially and pausing. - IMPROVED: Change the way of registering bitmap font. - FIXED: A GButton pivot issue. - FIXED: Correct text align behavior. 2.3.0 - NEW: Allow loader to load component. - NEW: Add text template feature. - FIXED: Exclude invisible object in FairyBatching. 2.2.0 - NEW: Modify shaders to fit linear color space. - IMPROVED: Improve relation system to handle conditions that anchor is set. - IMPROVED: Eliminate GC in transition. - FIXED: Fixed a bug of unloading bundle in UIPackage. - FIXED: Fixed issue that some blend mode(multiply, screen) works improperly. 2.1.0 - NEW: Add GGraph.DrawRoundRect. - NEW: Add FillType.ScaleNoBorder. - FIXED: Repair potential problems of virtual list. - FIXED: Fixed a bug in handling shared materials. 2.0.0 - NEW: RTL Text rendering support. Define scripting symbols RTL_TEXT_SUPPORT to enabled it. - NEW: Support for setting GObject.data in editor. - NEW: Support for setting selectedIcon of list item in editor. - IMPROVED: Add UIConfig.depthSupportForPaitingMode. - IMPROVED: Set sorting order of popup automatically. - FIXED: Fixed a text layout bug when line spacing is negative. - FIXED: Reset ScrollPane.draggingPane when an active scrollPane is being disposed. - FIXED: Fixed a bug of skew rendering.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值