Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Mathematical constructions, number systems. In 3D-graphics quaternions are used alongside vectors and matrices. One of the benefits of quaternions is that they overcome some rotational problems (known as gimbal locks) that are inherent to vectors and matrices.
0
votes
2
answers
680
views
Rotating only 2 axes of rotation quaternion to "point" in a direction
Where forward would bend towards the axis and start spinning.
float3 centerDir = math.normalize(sphereCenter.Value - translation.Value);
quaternion newRotation = rotation.Value;
float3 newUp = centerDir … ;
float3 newForward = mathx.Forward(newUp);
newRotation = quaternion.LookRotation(newForward, newUp);
float angleDiff = mathx.Angle(ltw.Forward, newForward);
quaternion negateYRotation = quaternion.RotateY …
2
votes
Accepted
Rotating only 2 axes of rotation quaternion to "point" in a direction
This is my solution:
I have added a new static function to my extension class, for easy access.
public static class mathx
{
public static quaternion LookRotationExactUp(float3 approximateForward, float3 … exactUp)
{
quaternion rotateZToUp = quaternion.LookRotation(exactUp, -approximateForward);
quaternion rotateYToZ = quaternion.RotateX(math.radians(90));
return math.mul(rotateZToUp …