Open dmarx opened 2 years ago
https://discord.com/channels/869630568818696202/869675528494391307/911779334312837161
Я — 11/20/2021 To rotate about an axis [x, y, z] by a degrees you will need
rotate_3d: [cos(radians(a/2)),x*sin(radians(a/2)),y*sin(radians(a/2)),z*sin(radians(a/2))]
.For example to rotate by 3 degrees per frame about:
- The x axis (looking up and down):
rotate_3d: [cos(radians(3/2)),sin(radians(3/2)),0,0]
- The y axis (looking left and right):
rotate_3d: [cos(radians(3/2)),0,sin(radians(3/2)),0]
- The z axis (tilting your head side to side):
rotate_3d: [cos(radians(3/2)),0,0,sin(radians(3/2))]
since cos(0) = 1 and sin(0) = 0, to rotate by 0 degrees (i.e. to not rotate) just do
rotate_3d: [1,0,0,0]
you need to understand how much you want to rotate each frame and also what axis you want to rotate around representing the axis as a unit vector
x,y,z
the rotation isrotate_3d: [cos(a),x*sin(a),y*sin(a),z*sin(a)]
wherea
is the rotation angle in radians so to very that with time you make a a function oft
-- https://discord.com/channels/869630568818696202/869675528494391307/924046784408453150
<blockquote class="twitter-tweet"><p lang="en" dir="ltr"><a href="https://t.co/7y7B0XyTKm">https://t.co/7y7B0XyTKm</a><br><br>rotate_3d: [cos(radians(6)),0,-sin(radians(6))/sqrt(2),sin(radians(6))/sqrt(2)]<br><br>translate_x: -1700*sin(radians(6)) <a href="https://t.co/BCQTYkRRjz">pic.twitter.com/BCQTYkRRjz</a></p>— ya (@sportsracer48) <a href="https://twitter.com/sportsracer48/status/1451562757174743047?ref_src=twsrc%5Etfw">October 22, 2021</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
Alternatively, the R_is_Ris vesrion
[cos(pi/a),cos(pi/(a*b)),d*cos(pi/(a*c)),cos(pi/a)]
, where abcd are constants that suit the motion of the scene (higher value, slower rotation)
this isn't a docs thing, but this feels like the right place to put it for now: https://github.com/moble/quaternion
https://quaternions.online/