tracing rocket movement

Blitz3D Forums/Blitz3D Programming/tracing rocket movement

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.

Graphics3D 640,480

phypiv = CreatePivot()
rocket = CreateCone(6):RotateMesh rocket,90,0,0

camera = CreateCamera()

ground = CreatePlane()
; you'll need to load your own texture here!
Tex = LoadTexture("grid.png")
ScaleTexture tex,10,10
EntityTexture ground,tex


PositionEntity rocket,0,5,0

Repeat
	; use left and right arrows to control rocket
	If KeyDown(205) Then TurnEntity rocket,0,-2,0
	If KeyDown(203) Then TurnEntity rocket,0,2,0
	
	; physics pivto stuff...
	RotateEntity phypiv,EntityPitch(rocket),EntityYaw(rocket),EntityRoll(rocket) ; point pivot the same as rocket
	MoveEntity phypiv,0,0,.01 ; add force to the rocket
	PositionEntity phypiv,EntityX(phypiv)*.99,EntityY(phypiv)*.99,EntityZ(phypiv)*.99 ; dampen movement
	
	; apply to rocket
	TranslateEntity rocket,EntityX(phypiv),EntityY(phypiv),EntityZ(phypiv)
	
	; cam
	PositionEntity camera,EntityX(rocket)-10,EntityY(rocket)+10,EntityZ(rocket)
	PointEntity camera,rocket
	
	RenderWorld
	Flip
Until KeyHit(1)