collision problem

Blitz3D Forums/Blitz3D Programming/collision problem

Ruz(Posted 2003) [#1]
I can't get my camera to collide with my level. It just goes straight trough all geometry. I think I am on the right track here , but I am new to programming, so if someone could help me out , cheers
obviously I don't need to collide with the skybox , just the village mesh.Did n't qute understand the 'pick' stuff either.

;; test level
; -------------------

Graphics3D 640,480,16,2
SetBuffer BackBuffer()

Const FPS=30

; Collision type values

Const type_camera=1
Const type_scenery=3

; CameraPick value
Global picked

player=CreatePivot()
PositionEntity player,0,0,0
EntityRadius player,.6
EntityType player,1

camera=CreateCamera( player )
CameraRange camera,.1,200
EntityRadius camera,1
EntityType camera,type_camera
PositionEntity camera,0,1,0
TranslateEntity camera,0,2,0



village=LoadMesh( "models\village1.x" )
ScaleEntity village,.1,.1,.1
EntityType village,type_scenery
TranslateEntity village, 0,10,0
EntityPickMode village,2

EntityFX village,(1+2)



Skybox=LoadMesh( "models\skybox.x")
ScaleEntity Skybox,.1,.1,.1
EntityType Skybox,type_scenery
EntityFX Skybox, 1

TranslateEntity Skybox,0,20,0


; Initialise collisions
Collisions type_camera,type_scenery,2,3




While Not KeyDown( 1 )

; Toggle camera fog mode between 0 and 1 when spacebar is pressed
If KeyHit( 57 )=True Then fog_mode=1-fog_mode : CameraFogMode camera,fog_mode

If KeyDown( 205 )=True Then TurnEntity camera,0,-1.4,0
If KeyDown( 203 )=True Then TurnEntity camera,0,1.4,0
If KeyDown( 208 )=True Then MoveEntity camera,0,0,-0.5
If KeyDown( 200 )=True Then MoveEntity camera,0,0,0.5
If KeyDown (30)=True Then MoveEntity camera,0,0.3,0
If KeyDown (44)=True Then MoveEntity camera,0,-0.3,0


RenderWorld

Text 0,0,"Use cursor keys to move around the village"
Text 0,20,"Press spacebar to toggle Fog 0/1"
If fog_mode=False Then Text 0,40,"CameraFogMode 0" Else Text 0,40,"CameraFogMode 1"



Flip

Wend

End


DrakeX(Posted 2003) [#2]
you have no UpdateWorld before the RenderWorld. UpdateWorld performs all collisions :)


Ruz(Posted 2003) [#3]
great that works, thanks a lot DrakeX.