TurnEntity - Quaternion Example

BlitzMax Modules Forums/MiniB3D/TurnEntity - Quaternion Example

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.

ok... so I might have been poking fun a little but :o

nice to see some of my code improved and contributed back!

only one minor point....
If KeyDown (KEY_W) = True 
	xturn.SetFromEulerXYZ(1,0,0)
	cubeQuat.multiply(xturn)
EndIf
...ETC...

might be better as
local xt:float,zt:float
xt=0;zt=0
If KeyDown (KEY_W) Then xt=1
If KeyDown (KEY_S) Then xt=-1
If KeyDown (KEY_D) Then zt=1
If KeyDown (KEY_A) Then zt=-1 
EndIf
if xt or zt then
	xturn.SetFromEulerXYZ(xt,0,zt)
	cubeQuat.multiply(xturn)
endif


This minimizes the number of computationally expensive calls and allows you to add in any other effects that might change the way the craft behaves (you might for example want to multiply xt and zt by 0.75 if the craft is overloaded)

90% of game programming is "faking it" and the reason most commercial games need such stupid hardware requirements is because the designers in their ivory towers have forgotten it!

I remember elite from the BBC 'B' micro and pine for the days when games actually had game play.

Please feel free to contact me via the email in my profile if you'd like any further help with this project.