collision

Blitz3D Forums/Blitz3D Beginners Area/collision

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.

ill just put the code and let you decide lol

Graphics3D 0,0,0,1
SetBuffer BackBuffer()
CT = LoadMesh ("collisiontest.3ds")
PositionEntity CT,20,10,2
EntityType CT,2
EntityRadius ct,5

camera=CreateCamera()
EntityRadius camera,5
PositionEntity camera,1,1,1
EntityType camera,1
light=CreateLight()


; Set terrain detail, enable vertex morphing
TerrainDetail terrain,4000,True

; Scale terrain
ScaleEntity terrain,1,50,1

; Texture terrain
ScaleEntity terrain,1,50,1
PositionEntity terrain,0,0,5

grass_tex=LoadTexture( "texture1.bmp" )
EntityTexture terrain,grass_tex,0,1
ScaleTexture grass_tex,75,75
EntityTexture terrain,grass_tex,0,1

While Not KeyDown( 1 )

If KeyDown( 203 )=True Then x#=x#-0.1
If KeyDown( 205 )=True Then x#=x#+0.1
If KeyDown( 208 )=True Then y#=y#-0.1
If KeyDown( 200 )=True Then y#=y#+0.7
If KeyDown( 44 )=True Then z#=z#-0.1
If KeyDown( 30 )=True Then z#=z#+0.1

If KeyDown( 205 )=True Then TurnEntity camera,0,-1,0
If KeyDown( 203 )=True Then TurnEntity camera,0,1,0
If KeyDown( 208 )=True Then MoveEntity camera,0,0,-0.1
If KeyDown( 200 )=True Then MoveEntity camera,0,0,0.7

x#=EntityX(camera)
y#=EntityY(camera)
z#=EntityZ(camera)

terra_y#=TerrainY(terrain,x#,y#,z#)+10

PositionEntity camera,x#,terra_y#,z#
UpdateWorld
RenderWorld

Collisions camera, ct, 1, 2

Collisions CT, camera, 1, 2
Flip

Wend

End