quaternions

3d camera has unintended roll

无人久伴 提交于 2019-12-24 07:39:43
问题 I've been working on a 3d camera in opengl using C++. When I look around with the camera, sometimes there will be unexpected roll in the camera, especially when I am rotating the camera in circles. I suspect this is a floating point error, but I don't know how to detect it. Here is the camera class: #ifndef CAMERA_H #define CAMERA_H #include <GL/glew.h> #include <GLFW/glfw3.h> #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp> #include <glm/gtx/transform.hpp> #include <glm/gtc

How can I calculate the rotation when using a quaternion camera?

妖精的绣舞 提交于 2019-12-24 01:18:18
问题 Given a quaternion camera, how can I calculate its rotation when the player can walk on different surface normals (walls). I'm working on a game which allows the player to walk on ceilings and walls in 3D space. I've opted to use a quaternion camera system to avoid Gimbal Lock. Given a set of up(0,1,0), right(1,0,0), and forward(0,0,1) vectors, I construct a quaternion. The player rotates around the up vector for heading and around the right vector for pitch. Without changing gravity vectors,

Why is my FPS camera rolling, once and for all?

戏子无情 提交于 2019-12-24 01:15:42
问题 If I ignore the sordid details of quaternions algebra I think I understand the maths behind rotation and translation transformations. But still fail to understand what I am doing wrong. Why is my camera rolling once and for all!? :) And to be a bit more specific, how should I compute the camera View matrix from its orientation (rotation matrix)? I am writing a minimalistic 3d engine in Python with a scene Node class that handles the mechanics of rotation and translation of 3d objects. It has

Unity - Gyroscope - Rotation Around One Axis Only

我与影子孤独终老i 提交于 2019-12-24 00:43:36
问题 I'm using Unity to make a game that uses the Gyroscope. I am trying to detect the rotation of the device around the axis that goes through the screen, I'm assuming it's the Z-axis in Unity Space. I tried using Input.gyro.attitude.eulerAngles.z but it doesn't stay constant when tilting the device around the other axes, I want it to stay constant so that only the "Z-axis" determines the rotation of a car's steering wheel, for example. How can I implement this? EDIT: I tried doing something else

Quaternion and three axes

旧城冷巷雨未停 提交于 2019-12-23 13:08:35
问题 Given a quaternion q, and three 3D vectors (vx, vy, vz) which form coordinate axes, which can be oriented in arbitrary direction, but are all perpendicular to each other, thus forming a 3d space. How can I check if the quaternion q is rotated to the same direction (or opposite direction) as some of the 3D vectors (vx, vy, vz)? 回答1: If q = (w,x,y,z), where w is the "scalar part", and qv=(x,y,z) is the "vector part", then you can calculate the angle between qv and each of the basis vectors vx,

Mapping outside quaternions to Unity

妖精的绣舞 提交于 2019-12-23 02:36:57
问题 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. 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

Find the rotational difference between two quaternions to calibrate two coordinate systems

£可爱£侵袭症+ 提交于 2019-12-22 17:42:47
问题 I need to offset streaming quaternion data by a specific amount. To do this I plan to get the difference between the 2, then offset the first by the second. I am having trouble finding the difference between the 2. Using this converter. I am running this code: public void convertQuat180() { Quaternion q = new Quaternion(0.65328f, 0.2706f, 0.65328f, -0.2706f); //45,180,0 Quaternion q180 = new Quaternion(0.70711f, 0, 0.70711f, 0); // 0,90,0 Quaternion result = q180 * Quaternion.Inverse(q);

How to convert the positions of connected joints to relative delta rotations

℡╲_俬逩灬. 提交于 2019-12-22 06:57:03
问题 I'm currently implementing a C++ solution to track motion of multiple objects. In that I have tracked points of those objects in a frame sequences such that multiple points in each frame. As a result of that I have x, y, z coordinates of those points of the entire frame sequence. By studying an already generated model I understood it consists of a joints system which move relative to each other. Every joint has a parent and their movements are written relative to its parent in Quaternion

Convert a Unit Vector to a Quaternion

懵懂的女人 提交于 2019-12-22 05:52:21
问题 So I'm very new to quaternions, but I understand the basics of how to manipulate stuff with them. What I'm currently trying to do is compare a known quaternion to two absolute points in space. I'm hoping what I can do is simply convert the points into a second quaternion, giving me an easy way to compare the two. What I've done so far is to turn the two points into a unit vector. From there I was hoping I could directly plug in the i j k into the imaginary portion of the quaternion with a

What's a quaternion rotation?

浪尽此生 提交于 2019-12-22 01:26:56
问题 Is quaternion rotation just a vector with X,Y,Z which the object will rotate towards, and a roll which turns the object on its axis? Is it that simple? Meaning if you have X=0, Z=0 and Y=1 the object will face upwards? And if you have Y=0, Z=0 and X=1 the object will face to the right? (assuming X right, Y up and Z depth) 回答1: A quaternion has 4 components, which can be related to an angle θ and an axis vector n . The rotation will make the object rotate about the axis n by an angle θ. For