How do I create a loop-around world?

Blitz3D Forums/Blitz3D Programming/How do I create a loop-around world?

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.

Joe, the problem is duplication and managment.

I was thinking about the multiple camera thing and thought the easy solution would be to parent the additional cameras to the main cam.

Graphics3D 1024,768,32,2

camera = CreatePivot()

Dim cam(8)
For n=0 To 8
	cam(n) = CreateCamera(camera)
	If n=1 Then PositionEntity cam(n),-20,0,20
	If n=2 Then PositionEntity cam(n),0,0,20
	If n=3 Then PositionEntity cam(n),20,0,20
	If n=4 Then PositionEntity cam(n),-20,0,0
	If n=5 Then PositionEntity cam(n),20,0,0
	If n=6 Then PositionEntity cam(n),-20,0,-20
	If n=7 Then PositionEntity cam(n),0,0,-20
	If n=8 Then PositionEntity cam(n),20,0,-20
	CameraClsMode cam(n),0,1
Next

PositionEntity camera,0,5,0

light = CreateLight()
TurnEntity light,45,45,0

For x=-5 To 5
For y=-5 To 5
	cc = CreateCube()
	PositionEntity cc,x*2,0,y*2
	EntityColor cc,Rand(50,255),Rand(50,255),Rand(50,255)
	ScaleEntity cc,1,.001,1
Next
Next

Repeat
	Cls
	
	If KeyDown(200) Then MoveEntity camera,0,0,.1
	If KeyDown(203) Then MoveEntity camera,-.1,0,0
	If KeyDown(208) Then MoveEntity camera,0,0,-.1
	If KeyDown(205) Then MoveEntity camera,.1,0,0
	
	If EntityX(camera) > 10 Then TranslateEntity camera,-20,0,0
	If EntityX(camera) < -10 Then TranslateEntity camera,20,0,0
	If EntityZ(camera) > 10 Then TranslateEntity camera,0,0,-20
	If EntityZ(camera) < -10 Then TranslateEntity camera,0,0,20
	
	RenderWorld
	
	Text 0,0,EntityX(camera)
	Text 0,10,EntityZ(camera)
	Flip
Until KeyHit(1)


Obviously in this example the landscape is so small you see the repeats, however you would have the landscape larger than the camera view distance and you won't get the flick.

Something's not quite right with that example though as there seems to be a band of colours that changes when the cam gets moved, this it's probably a positioning problem.

On top of this if you use 3D objects you will have to manage the order of which camera gets rendered otherwise you'll get 'strange' results if stuff at the back is rendered after stuff at the front.