What's wrong with my collisions?

Blitz3D Forums/Blitz3D Beginners Area/What's wrong with my collisions?

I can still walk right through the walls.

Graphics3D 640,480 
SetBuffer BackBuffer() 

;collisions
level_col = 1
camera_col = 2
guy_col = 3

camera=CreateCamera() 
PositionEntity camera,2,1,2  

;load guy
guy = LoadMesh("models/smiley.b3d")
ScaleMesh guy,0.04,0.04,0.04
PositionEntity guy,4,1,4

;load level
level = LoadMesh("maps/level1.b3d")
ScaleMesh level,0.04,0.04,0.04
PositionEntity level,0,0,0
 
;collision setup
Collisions level_col,camera_col,2,3
Collisions level_col,guy_col,2,3
EntityType camera,camera_col
EntityType guy,guy_col
EntityType level,level_col

While Not KeyDown( 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.05 
If KeyDown( 200 )=True Then MoveEntity camera,0,0,0.05 

RenderWorld 

Text 0,0,"Camera's x coordinate:" + EntityX(camera)
Text 0,10,"Camera's y coordinate:" + EntityY(camera)
Text 0,20,"Camera's pitch:" + EntityPitch(camera)
Text 0,30,"Camera's yaw:" + EntityYaw(camera)

Flip 

Wend 

End 


Two things:

- You've set up level-to-guy/camera collisions, instead on guy/camera-to-level.

- You need UpdateWorld in your main loop.

(edit)
Also, use EntityRadius for both camera and guy
EntityRadius camera, 1
entityRadius guy, 0.04 ;(?)

Thanks!

Now I have a new problem. I've put my collision radius up to 1.5 since it's the highest it will go up to without going through the mesh. Now I can't even fit through doors which are bigger than me. If I scale the mesh even higher, it will look unrealistic. What do I do?

Picture here: http://devdave.net/doortoosmall

Will I have to scale the mesh bigger, and make the camera zoom in a little?

EntityRadius allows you to specify an X and Y radius, to define an ellipsoid. So, you should be able to make your collision ellipsoid tall and thin, to fit through doors.

But the whole thing is that I can't fit sideways into the door. If I make the radius smaller, then the camera goes through the sides of the actual door (literally).

Should I do what I suggested? Scale the level and than mess around with the camera?

I don't think I understand your problem properly, as I don't see how scaling the level mesh will help. Maybe simply zooming the camera in a bit will help?

Anyway, if you think you have a solution, give it a try. :)

The camera is too large to fit through the door. But that's ok. For a minute, I forgot I was making a 3rd person game. I'm going to scale the level up and place my tiny camera behind the player. Now I just need to figure this all out so that the player can fit through the door.

What is it that you don't understand? I can't fit something through my door without lowering its radius and making the collisions crappy looking.

The camera is too large to fit through the door.
That's what I don't understand: a camera doesn't have a size - it's just a point in 3D space, like a pivot.

If by 'size', you're refering to the collision sphere applied to the camera, then just reduce it so that it fits through the door.

The height of the camera should be separate from its EntityRadius. First set a smaller EntityRadius, then adjust the camera's offset using this:

UpdateWorld
MoveEntity camera, up
RenderWorld
MoveEntity camera, down