lost children

Blitz3D Forums/Blitz3D Beginners Area/lost children

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.

A child is what an entity is after your parent it to another.

pivot = CreatePivot()

camera = CreateCamera()

EntityTexture camera,pivot



The camera is now a child of the pivot. What ever happens basically to the pivot, will affect all it's "children".

You could say place the pivot at the characters location, then move the camera away from the pivot. Then rotate the pivot, and the camera will swing round, like an orbiting planet.

Small demo

Graphics3D 800,600
SetBuffer BackBuffer()

light=CreateLight()

pivot=CreatePivot()

camera=CreateCamera()
EntityParent camera,pivot
PositionEntity camera,0,0,-5

cube=CreateCube()

While Not KeyHit(1)


	If MouseDown(1) Then MoveEntity camera,0,0,1
	If MouseDown(2) Then MoveEntity camera,0,0,-1
	
	If KeyDown(203) Then TurnEntity pivot,0,1,0
	If KeyDown(205) Then TurnEntity pivot,0,-1,0
	
	
	UpdateWorld
	RenderWorld
	Text 0,0," MOUSE BUTTON 1 : Move camera forward"
	Text 0,10," MOUSE BUTTON 2 : Move camera backwards"
	Text 0,20," LEFT ARROW key and RIGHT ARROW key : turn the pivot
	Flip
Wend
End