将外部四元数映射到Unity [英] Mapping outside quaternions to Unity

查看:124
本文介绍了将外部四元数映射到Unity的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用四元数将传感器的旋转映射到Unity中,但是我无法 似乎弄清楚了为什么旋转不能正确映射.

I'm trying to map rotations from a sensor into Unity using Quaternions, and I cannot seem to figure out why rotations do not map correctly.

我正在使用 Adafruit BNO055 来以四元数的形式拉伸绝对方向.这 可以在此处中找到其Quaternion实现的来源.据我了解 四元数,这几乎没有什么,我应该能够将四元数从传感器中拉出, 将其泵入Unity内部的任何GameObject中,以便它们共享相同的方向.如果我有一个循环 设置为从传感器读取四元数数据并将其泵入Unity,GameObject应该 旋转就像物理世界中的传感器一样.不幸的是,这没有发生.

I'm using the Adafruit BNO055 to pull absolute orientation in the form of Quaternions. The source for their Quaternion implementation can be found here. From what I understand about Quaternions, which is almost nothing, I should be able to pull a Quaternion out of the sensor and pump it into any GameObject inside Unity so that they share the same orientation. If I had a loop set up that read the Quaternion data from the sensor and pumped it into Unity, the GameObject should rotate exactly like the sensor in the physical world. Unfortunately, this is not happening.

从传感器发送到Unity的数据的示例

An example of the data sent from the sensor to Unity

w: 0.903564
x: 0.012207
y: 0.009094
z: -0.428223

从传感器发送的四元数是否不等于Unity中使用的四元数?如果没有,如何 我该如何正确映射这些映射?

Is the Quaternion sent from the sensor not equal to the Quaternions used in Unity? If not, how would I go about getting these mapped correctly?

在此先感谢您的帮助!

推荐答案

仅以不同的转换为例(包括Unity和OpenGL) https://developers.google.com/project-tango/overview/coordinate-systems

Just for example of diffrent conversions (including Unity and OpenGL) https://developers.google.com/project-tango/overview/coordinate-systems

我不知道您的设备和坐标符号,但是您可以通过一些定向实验来恢复它.

I don't know your device and coordinates notation, but you can recover it making some experiments with orientation.

转换的主要问题是,转换矩阵可能包含MIRRORING(-1矩阵分量).仅重新布置旋转轴是无法解决的.

The main problem of conversion, that conversion matrix may contain MIRRORING (-1 matrix component). And can't be solved just rearanging rotation axes.

这篇关于将外部四元数映射到Unity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆