Need Help With the maths for a space game

Blitz3D Forums/Blitz3D Programming/Need Help With the maths for a space game

SSS(Posted 2003) [#1]
hi all, i just, 5 minuits ago started a spaceship/shooting game and already i am stuck :D anyway the problem is with the rotation of ships, it rotates fine but it won't do accumulated rotation i know why it does it but i dont know how to solve it, i havnt gotten up to vector mathmatics or the like in maths yet....
thanks alot for any help here is my code


Include "def.bb"

Global Camera
Initialize()
PositionEntity Camera, 0,5,-20
player.Ship = CreateShip("Ships\test.ship")
PositionMesh player\Model,0,MeshHeight#(player\Model)/2,0


While Not KeyDown(1)

	If KeyDown(200) Then player\Rotation\x = player\Rotation\x+3
	If KeyDown(208) Then player\Rotation\x = player\Rotation\x-3
	If KeyDown(203) Then player\Rotation\z = player\Rotation\z+3
	If KeyDown(205) Then player\Rotation\z = player\Rotation\z-3
	RotateEntity player\Model,player\Rotation\x,player\Rotation\y,player\Rotation\z
	RenderWorld()
	Flip()
Wend



LostCargo(Posted 2003) [#2]
what do you mean by accumulated rotation?
if you mean where adding more thrust in a direction (or rotation) you seem to already be doing it.


SSS(Posted 2003) [#3]
sry for being unclear, if i rotate it in the Z axis 45 degrees and then press the upkey it will rotate incorrectly for a plane ship etc... because it will only rotate on the x axis instead of on the x and z axises


LostCargo(Posted 2003) [#4]
SSS,
Im thinking you might be needing turn entity. Not rotate entity.

Rotate entity is for absolute orientation. Turnentity is relative to the object. Pefect for your needs (ie pulling back on the stick will pull the nose of the plane up regardless if it is banking )

http://www.blitzbasic.com/b3ddocs/command.php?name=TurnEntity&ref=