quaternions

threejs: smoothly rotate camera towards an object

柔情痞子 提交于 2019-12-12 03:28:36
问题 i have just started to study three.js and i am having some trouble to write a function that takes as arguments an object position (Vector3) and a time in milliseconds, and gradually rotate the camera to face it in that time. Substantially a lerp version of the builtin lookAt method. First i've tried using tweenjs to get smooth rotate transition. For the start and end parameters i've created a dummy object and set its position, rotation and quaternion the same as the camera, then i have use

In c++, how to traslate a point attached to another in 3D space according to the latest one's quaternion rotations

假如想象 提交于 2019-12-12 03:15:39
问题 I have to possitions, p1 and p2, p2 is attached to p1, not only to p1's position but also to it's rotation, so q1 is a quaternion which represents p1's rotation. If q1 rotates, then p1's position must also rotate around p1 accordingly. I only need to calculate p2's position, not it's rotation, I worked the rotation out already. So basically is a spaceship docked to a station, I need to move and rotate the station around with the ship docked to it. How do I do it? the code i wrote for it works

How to multiply two quaternions by python or numpy [duplicate]

烈酒焚心 提交于 2019-12-12 02:10:02
问题 This question already has answers here : Creating uniform random quaternion and multiplication of two quaternions (2 answers) Closed 3 years ago . I have two quaternions: Q1= w0, x0, y0, z0 and Q2 = w1, x1, y1, z1. I would like to multiply them by using NumPy or Python function which can return 2-d array. I found some pseudocodes on the internet which is written by Christoph Gohlke to do this kind of multiplication. I tried a lot but failed to apply it. Can anyone help me please to do this

Problems converting axis angle to quaternion

冷暖自知 提交于 2019-12-11 23:18:22
问题 I have a vector which points from my camera to an object I want to point to, so I want to make a quaternion which rotates the camera so that it points to that vector. So i do this (using glm) glm::quat rotation=glm::angleAxis(0.0f,vector); If i understand that function correctly in the case of a vector of, for example, (0.0f,0.0f,-1.0f), the camera should point forward in the depth axis, and with no roll. But i don't know why, in that case it creates this quaternion: x:-0 y:-0 z:-0 w:1 wich

iOS orientation estimation and heading error

落爺英雄遲暮 提交于 2019-12-11 22:02:53
问题 Instead of doing my own sensor fusion, I am using the Quaternions available from iOS and converting them to Euler angles. I walked around in a rectangle shape for few times and I observe that the shape is not as expected. I am plotting the shape by plotting the Yaw values. Please see below. It appears that the heading deviates significantly. I maintained the path while walking. How do I correct the Yaw values so I get correct rectangle shape. 来源: https://stackoverflow.com/questions/30941993

Processing: Rotating a 3D object using Quaternions works for x-axis, but not for y or z axis?

不羁的心 提交于 2019-12-11 17:08:30
问题 I'm creating a Quaternion from input from a serial device. In Processing I rotate around the x-axis in the code below. My Quaternion object takes the input and uses the set function to set the values, euler angles, and normalize. Is there something wrong with the math? I commented out rotation for z and y, but basically the object doesn't rotate around very well or is jerky compared to the x-axis, which works perfectly. What am I doing wrong in the code below? For reference, the shape(model)

Unity3D Leap Motion - Put hand in static pose (Pose done just can't rotate)

时光怂恿深爱的人放手 提交于 2019-12-11 16:39:33
问题 I am trying to set the hand into one of a series of poses. I have created a script that captures a frame, serializes the left hand which is then stored as an xml for loading. I currently have the system setting the hand to the correct pose by calculating the offset between the palm position in the live data and that of the stored pose. The problem I am having is getting the hand to rotate. The 'hand' parameter is the current hand from the live data and the 'pose' parameter is the hand that

Rotate camera to look at Selected object in three.js

强颜欢笑 提交于 2019-12-11 16:36:28
问题 I am trying to design a map. So, when I select any geometry, I want the object to come at the centre of the viewport and the camera to be looking at it. I have spent quite a lot of time looking everywhere on the web but failed to find the answer. Please note that I don't want to rotate the object. I just want to update the camera. I am trying to get something like in this example where when we click the number, it comes to the centre : https://sketchfab.com/3d-models/jurassic-aquarium-diorama

Prevent rotation around certain axis with Quaternion

ⅰ亾dé卋堺 提交于 2019-12-11 15:26:48
问题 I'm programming camera controls with a mouse. I want the user to be able to look up and down or left and right but not be able to "tilt" to the side. Put another way, I want to allow Yaw and Pitch to change but restrict Roll to 0. How can I prevent a Quaternion from rotating around a certain axis? When I only allow x-axis rotation or y-axis rotation by themselves, everything works fine, but when I allow both at the same time for some reason the y-rotation is affected and the camera tilts to

3D Create a point to a distance taking in consideration the Player Y rotation

依然范特西╮ 提交于 2019-12-11 15:02:56
问题 I need to define a 2D plane area in front of a Point(which is our player position) and check which Points(enemies) are within it. In the game it is used to determine what enemies are within the "box" in front of us with X width, Y height and Z length. I need help calculating the bottom left and top right points of the plane. Input : We know the player position and we know the player rotation. Only the player Y rotation matters, as the plane should always be in front of the player. We know the