123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|292|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> How do I make collision detection between with Cube and Camera?

Wed, 13 Jun 2007, 04:05
Hotshot
Hey all

I have code in BLITZ 3D and when I move the camera then it walk through the wall(CUBE) which I didnt want.

How do I make collision between camera and cube?

Hope I have explain it well

cheers
Wed, 13 Jun 2007, 04:11
Jayenkai
Create a second cube, and attach it to the camera.
Cube2=CreateCube(Camera)
Then hide it by setting it's Alpha to 0. When set to 0, you can't see it, but the collision code can.

Assuming you know how to do the basic collision stuff, just set the 2nd cube to collide with the world, instead of trying to do it with the camera.

(If you don't know the basic collision stuff, then I'll leave it up to others to explain... I can just about manage 3D stuff, so I'm probably not the best person to explain it!!)

-=-=-
''Load, Next List!''
Wed, 13 Jun 2007, 04:33
JL235
You could also use the linepick command, which I believe is the better way to do collision with cameras.

Read the command reference for a full explanation, but if the function returns nothing, then you can move. Otherwise don't move.

I remember when I was making my fps years ago I used a sphere for the cameras position and checked for collisions, but it just didn't work very well. A really good open source fps example used linepick.
Wed, 13 Jun 2007, 14:37
bram32
The 'classic' way is like this: you can setup collisions between the camera and the cube with the EntityType, EntityRadius and Collisions commands:

However, using LinePick could also be a good idea. In the demo version of Blitz3D, there is a FPS example which seems to work quite well.
Wed, 13 Jun 2007, 17:50
magicman
hmm, i dont remember how exactly i did collisions with the camera in my FPS, i think i just made a pivot and called it player, or somthing like that.

-=-=-
Stuff... Yeah...
Thu, 14 Jun 2007, 09:36
Hotshot
hiya bram32 and I do remmy you
the code look good and I will try it out when I get home.

cheers


Thu, 14 Jun 2007, 15:00
bram32
Hi Hotshot, I was wondering if it was you. Greetings then, and I hope the code works okay.