#Include "Ninfa3d.bi"
'Thanks Evolved for map from Map - Scape
'Thanks Democar for impreza mesh
dim camera As nCAMERA
Dim  As nMESH city1,city2
Dim  texcub As nTexture
Dim As nJOINT joint(20 to 29)
dim as single xt,yt,zt,yc
dim As nLIGHT light01

'Enable vertical synch.
EnableVsync()



'Starts the Ninfa3D Engine
InitEngine(640,480,32,0)
	BackGroundColor(128,128,200)'Background Color
	WorldGravity(0,-200,0)
	WorldSize(20480,5120,20480)
	PhysicQuality(Q_linear)
    AmbientLight(230,230,230)'Ambient color
   
Dim As nMESH mshsph = CreateMeshSphere(12)'use this sphere as pivot camera
ScaleMesh( mshsph, 0.1, 0.1, 0.1 )
PositionEntity(mshsph,0,-10,-50)
city1 = LoadMesh("city2/room3.x")'from cartographyShop export (free)
city2 = LoadMesh("city2/room3_lm.x")'from cartographyShop export (free)
'entityflag(city,3,1)
entitytype(city2,5)'alpha

Dim As nBODY bdy10 = CreateBodyTree(city1,0)'Create a cube body
PositionEntity(bdy10,0,0,0)

camera = CreateCamerafps(100,0.5)
camerarange(camera,0.1,12000)

positionentity(camera,0,50,0)

light01 = CreateLight(LGT_POINT)
    lightcolor(light01,100,100,50)
    lightradius(light01,256)
	PositionEntity(light01,0,200,0)' Position

dim as nmesh msh2 = CreateMeshCube()'Load a mesh
		ScaleMesh(msh2,50,50,50)
        EntityColor(msh2,200,0,200)
        

dim as nbody bdy2 = CreateBodyCube(50,50,50,1)'Create a cube body
		EntityParent(bdy2,msh2)'This makes the mesh assigned, follow both
								  'Position as the rotation of the body.
		PositionEntity(bdy2,0,100,100)

'collisions(city1,camera,2)
While(EngineRun)'Returns 1 if the engine is running.

	'Begins scene
	BeginScene()
	
	'By pressing the "ESCAPE" closes the engine.
	If KeyHit(KEY_ESCAPE) Then CloseEngine()
	WorldMousePick(MouseX(),MouseY(),MouseDown(MOUSE_LEFT))
    
	'Update the Engine.
	'Changing the value (only affects the physics) that will update the
	'Physical faster or slower.
	UpdateEngine(0.05)

	
	

	EndScene()
	
Wend

'Ends Ninfa3D Engine
EndEngine()