Camera collision with cube

BlitzMax Forums/MiniB3D Module/Camera collision with cube

apamment(Posted 2013) [#1]
Hi, I'm new to MiniB3D. I'm trying to make the camera stop when it hits a cube. I've been searching the Blitz3D forum and I think I'm understanding how the collisions command works, but my camera keeps going right through the cube.

My code:

[bbcode]
?linux
Import"-ldl"
?

Import sidesign.minib3d

Graphics3D 800 , 600 , 16 , 2

player = createSphere()
camera = CreateCamera(player)
EntityType player , type_camera

light = CreateLight()
RotateEntity light , 90 , 0 , 0

cube = CreateCube()
EntityType cube, type_cube

PositionEntity cube, 0, 0, 5


Collisions type_camera,type_cube,2,1

repeat
If KeyDown(KEY_W)
MoveEntity player , 0 , 0 , .1
endif

If KeyDown(KEY_S)
MoveEntity player , 0 , 0 , - .1
endif

If KeyDown(KEY_Q)
MoveEntity player , - .1 , 0 , 0
endif

If KeyDown(KEY_E)
MoveEntity player , .1 , 0 , 0
endif

If KeyDown(KEY_A)
TurnEntity player , 0 , 1 , 0
endif

If KeyDown(KEY_D)
TurnEntity player , 0 , -1 , 0
endif
UpdateWorld

RenderWorld


flip
Until KeyHit(KEY_ESCAPE) Or AppTerminate()
[/bbcode]


Midimaster(Posted 2013) [#2]
as far as I remember, the paramter collision_typ has to be a selfmade ID

Graphics3D 800 , 600 , 16 , 2

; define any ID: 
type_camera=1111
type_cube=2222

player = createSphere()
camera = CreateCamera(player)
EntityType player , type_camera

light = CreateLight()
RotateEntity light , 90 , 0 , 0

cube = CreateCube()
EntityType cube, type_cube

PositionEntity cube, 0, 0, 5
Collisions type_camera,type_cube,2,1
.....



apamment(Posted 2013) [#3]
that works thankyou