dude actually what the fuck is a quaternion (nerd shit)

game program stuff:
i need a vector3 for orientation(this means rotation), vector3 comes in X,Y,Z
this is similar to coordinates (think minecraft), you can rotate something on the X axis, Y axis or Z axis, but if you try to do all 3 itll do wtvr it wants basically
this is what the math looks like for a 2d vector, (x and y bc only 2 dimensions)

2d quan
to rotate, get (x,y)
#° roateted == cos(#°) + sin(#°)i   <-this is by how many degres you rotate ur geomotry
or cos(#) + sin(#)i
ex:
coords (5,3)
rotate by 45 degrees
x coordinate -> (5cos(45°) - 3sin(45°)) + (3cos(45°) + 5sin(45°))i <- Y coordinate
x = 2 sqrd or 1.414
y = 4*2sqrd - 1 or 6.457

so if you have a 2d shape thats furthest position = (5, 3) and you rotate it by 45 degrees,
the furthest position goes from (5, 3) to (1.414, 6.457)

i have yet to find that is comprehendable for 3d, they use ijk for xyz i think????? idk, if you know anything abt this pls help me out


0 Kudos

Comments

Displaying 2 of 2 comments ( View all | Add Comment )

Benji

Benji's profile picture

I don't know them either, but what I know about them is that they are a set of math processes in a specific order for physics simulation. If you tried to program the math that they do by hand, your program can run faster but it's really hard to do right. Quaternions are meant to make programing easier by doing all the math needed for every use case even if it's slower. My best guess is to study how they work so you know how the process works. No matter if you use them or not, you will need to understand the process that quaternions help with to do what you need to do. There might be resources or textbooks that might help to understand them. That's what Sethbling did for his block entity rigid body simulation datapack.


Report Comment



damn ok tysm dude ill look into it rn

by CaffeLatteBirb; ; Report

CaffeLatteBirb

CaffeLatteBirb's profile picture

little edit if it matters, y for the vector2 problem is actually -5.65685424949, not posotive ~6.4


Report Comment