Advertisement
StefanBashkir

Untitled

Mar 7th, 2015
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. "I dont want to understand the 9 arugment rotation matrix, thats like calculus. "
  2.  
  3. Actually, no. The 9 argument rotation matrix is probably the simplest form of storing rotation. Readability wise, Euler Angles are the best. However, mathematically, Euler Angles are the second most complicated way of storing rotation (quaternions only being more complicated in theory).
  4.  
  5. "i'de explain it to you but you wouldn't understand it anyways"
  6.  
  7. Most likely because you don't even know. Good try, young 'analyze.'
  8.  
  9. On to the original question, let me first say that I recommend using Axis Angles and not Quaternions. The concept of both of them is the same. Rotation about an axis; however, Axis Angles are a lot easier to work with. Quaternions are typically used to spherically interpolate rotations or store them. Manipulating them in real-time field work is like.... killing yourself.
  10.  
  11. You might see CFrame.new(x,y,z, r1,r2,r3,w)
  12.  
  13. And wonder... what? How can it have four rotation dimensions? Well stop... because it really isn't as it seems. It's similar to axis angles. The r1,2,3 is the unit axis to spin around, and the w is the rotation number. Rotate around an axis, that's axis angle isn't it? Yes. So what makes a quaternion different? Well...
  14.  
  15. To keep it simple, we're not gonna worry about the math, alright? Who cares, let's visualize it.
  16.  
  17. An axis angle rotate about a point in a 2D circle. Easy, right? Let's say I wanted a part to rotate like a sentry gun (around a pivot) using an axis angle:
  18.  
  19. Part.CFrame = CFrame.fromAxisAngle(Vector3.new(0,1,0), math.pi/2)
  20.  
  21. The way it rotates around the vector pool 0,1,0 is in a circular motion. HERE is the fun part...
  22.  
  23. Quaternions rotate around their axis... in a 3D spiral. This is why quaternions are weird. You would think "How do they rotate in a 3D spiral when their rotation about a single axis is seen in 2D?" Well, that's because their mathematical formula involves complex numbers (imaginary numbers) and thus their solutions usually lie in the complex plane of numbers. Try rotating something in a quaternial form using a for loop to go from math.pi/2 to -math.pi/2 on the same axis. It won't make sense because you might be trying to visualize the rotation around the axis you give it as 2D, when, in fact, it's rotating in 3D.
  24.  
  25. Watch this video for a picture of what I mean by 3D spiral rotation: https://www.youtube.com/watch?v=KdW9ALJMk7s&t=239
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement