Blitz3D Quaternions

Blitz3D Forums/Blitz3D Programming/Blitz3D Quaternions

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I am having trouble converting eulers into quaternions for use in .b3d files. I am using the code from Mark Sibly's MS3D .b3d exporter, but it does not produce correct results:

Procedure EulerAsQuat(pitch.f,yaw.f,roll.f)
sp.f=Sine(pitch/2.0)
cp.f=Cosine(pitch/2.0)
sy.f=Sine(yaw/2.0)
cy.f=Cosine(yaw/2.0)
sr.f=Sine(roll/2.0)
cr.f=Cosine(roll/2.0)
vectorw.f=cr*cp*cy+sr*sp*sy
vectorx.f=sr*cp*cy-cr*sp*sy
vectory.f=cr*sp*cy+sr*cp*sy
vectorz.f=-(cr*cp*sy-sr*sp*cy)
EndProcedure