Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

3 Dimensional Chat / Ground Collision detection question

Author
Message
Cowboy
21
Years of Service
User Offline
Joined: 1st Oct 2003
Location: Sydney
Posted: 2nd Oct 2003 07:31
Hi All,
I'm designing a 3d version of a 2d platform type game. I have floors/levels (done as 3d boxes) one above the other at this point to represent the platforms and am experimenting with the controls for getting the player around.
I can use the collision detection as per the sliding collision detection example for detecting the ground when the player (a trusty cylinder) jumps. How though would I include a ladder where the player gets up to the second level. The player will essentially come through the "floor" so I need to be able to turn collision detection off for that part of the platform I'm climing through. I want that part to act as both a ladder point where they can climb down, a floor they can run accross if they don't want to go down.
Any ideas GREATLY appreciated!!!!!!
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 2nd Oct 2003 15:09 Edited at: 2nd Oct 2003 15:11
You could expand on your box collision - like if your floor is a big box, then the ladder can be surrounded by another box. You'd check for collision with the ladder box and make it so you can move up and down inside it. For good control it's nice if your ladder is like a sorta portal where you can move in 3D, but step too far away from the ladder and it's outside the box again and he falls. Normally I'd run straight for a ladder then look up and expect to zip up the ladder - if you can get it to do that then your laughing.

Perhaps you'll need a maths collision method though. If you store the location and size of your collision box in an array - you could make it so a function simply returns the collision flag, you'd call a function with the player coordinates, and it returns the flag. You could give each box a type too, so type 1 might be a solid box, type 2 might be thin air, type 3 might be a ladder, type 4 might be a light switch etc etc. The cool thing is that using this style of collision means you can make a box then cut a hole in it, making doors is quick and easy - makes for easy lift raising and lowering too - because you only need to assign the box data to the actual 3D object position and the system would do the rest. Also, besides just returning a collision flag, I strongly suggest setting global variables to the return location of the collision, so the player height is taken from the collision data - makes things very smooth and helps avoid those falling through floor bugs.


Van-B

My cats breath smells of cat food.
Cowboy
21
Years of Service
User Offline
Joined: 1st Oct 2003
Location: Sydney
Posted: 3rd Oct 2003 04:16
Thanks a lot for the suggestion!!!!!

Login to post a reply

Server time is: 2025-05-15 22:31:34
Your offset time is: 2025-05-15 22:31:34