Author Topic: Euler rotation => Quaternion rotation [BB2D]  (Read 12034 times)

0 Members and 1 Guest are viewing this topic.

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Euler rotation => Quaternion rotation
« Reply #20 on: July 18, 2007 »
The difficulty is still - what's the question/problem? - not what the answer is :)

Jim
Challenge Trophies Won:

Offline Devils Child

  • C= 64
  • **
  • Posts: 66
  • Karma: 2
    • View Profile
Re: Euler rotation => Quaternion rotation
« Reply #21 on: July 18, 2007 »
aaaah now i see it. it's a wireframe cube! sry my dumbness, i thought it was an engline without sample.
thats exactly what i need!
thank you :updance:

edit: this is compatible with 4x4 matrices?
or do i actually need 4x4 matrices or do i just need 3x3 matrices?
i need {rot/scale/pos}
« Last Edit: July 18, 2007 by Devils Child »

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: Euler rotation => Quaternion rotation
« Reply #22 on: July 18, 2007 »
Glad you see it now :) If you want you can use create_entity to create a camera in main() too, then you need to send that through to the rotate_vertices function where you can multiply the camera and the object matrices and use the result to do the rotation (along with some calcs for the position of the object in camera space), you can put scaling into that matrix too. That matrix can be used for the top-left 9 elements of the opengl matrix and the position is put into either the right column or the bottom row (can't remember which) but you might need to negate z somehow.

I don't have any blitz code, I put this together from bits and pieces from other languages but if you want I can add in some more of that stuff.

Offline Devils Child

  • C= 64
  • **
  • Posts: 66
  • Karma: 2
    • View Profile
Re: Euler rotation => Quaternion rotation
« Reply #23 on: July 18, 2007 »
now, i see EXACTLY what this is all about!

instead of:
Code: [Select]
vglMatrixRotate(rotation, rotation, rotation)i do:
Code: [Select]
for i = 1 to rotation
    vglMatrixRotate(1, 1, 1)
next

now i only have to do a dynamic matrix system in which the user can create more matrices (for each entity one) now i really got it! thanks a lot guys! i will write it down right away!!!
 :inspired:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: Euler rotation => Quaternion rotation
« Reply #24 on: July 18, 2007 »
That would be slightly different, it would work but you'd only be able to rotate in fixed step sizes (e.g. 1 degree steps). Whichever way though, I think you do need to store the whole matrix for each object.