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.

DarkBASIC Discussion / Object collision. Enough Said.

Author
Message
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 26th Jun 2005 02:56
I have a character, and a castle. Both 3D objects. The character floats in midair while standing and walking. The character walks through the walls of the castle.
How do I make him walk on the castle floor, and how do I prevent him from going through walls?

Enjoy Life while your still alive.
Enjoy a recees anytime!
Drew Cameron
21
Years of Service
User Offline
Joined: 30th Jan 2004
Location: Scotland
Posted: 26th Jun 2005 03:32
Look into something called 'Nuclear Glory' on these forums or in Google, it is by far the easiest way to do what you are talking about.

Dumbo and Cool

WIP Board!
Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 26th Jun 2005 03:39
Another way is to split the castle into floors and wall (seperate objects).

please reply
Hop a long
21
Years of Service
User Offline
Joined: 12th May 2004
Location: The Code Dump
Posted: 28th Jun 2005 10:04
Hi GreenFox,
You have asked a very popular question. If you try a search you will probably be surprised by the number of possible solutions.

Mean while here are some hints:
http://www.geocities.com/hifin2003/skinny_walk.html
http://www.geocities.com/hifin2003/fpswalk.html
RUCCUS
20
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 9th Jul 2005 11:27
Use the object intersection command if youre interested in making it yourself and not using Dll's. Or you could check out COLD in the WIP boards, its a function for this, almost complete but should suit your needs for now.


Current Projects: SHADE - Game Maker | Mecho - TGC Puzzle Entry | Halo Physics Engine | COLD - Polygonal Collision Detection
Big Man
20
Years of Service
User Offline
Joined: 4th Feb 2005
Location: BEHIND YOU!!!! (but I live in England)
Posted: 9th Jul 2005 21:44
Have you thought about positioning your objects Y position to the level of the ground.

Our aim is to keep the loo's clean, your aim can help.
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 11th Jul 2005 03:34
Big Man,
Yes I did but he went hrough hills .

Enjoy Life while your still alive.
Enjoy a recees anytime!
blanky
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 12th Jul 2005 03:41
Say your 'castle' is object 1, and your 'character' is object 2.

Position the character so that his feet is a little *ABOVE* the floor, and then change your code like this:

Quote: "` Say this was your 'move forward' code.
`Remember to turn collision on.
`I don't know what shape your castle is,
`so use this for now:
set global collision on

if upkey()=1
`Move the character forward
move object 2,1.0
`If he's now touching something, move him back again
if object collision(2,1)=1 then move object 2,-1.0
endif
"



Y'see, if you move the character back again before the next 'sync', as far as the player is concerned, the character hasn't moved.. at all.
There's probably better ways, but it works great for me. ^_^

How's my typing? Phone 0800-GO-TO-HELL
blanky
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 12th Jul 2005 03:43
O yeah, and you position his feet above the floor as otherwise as far as the game is concerned a 'collision' has occured, and he'll be glued to the spot like a glued thing.

How's my typing? Phone 0800-GO-TO-HELL
RUCCUS
20
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 12th Jul 2005 08:58
Just send an intersection ray below the user's feet, if an intersection occurs move the user up by like .1. Works perfectly.


Current Projects: SHADE - Game Maker | Mecho - TGC Puzzle Entry | Halo Physics Engine | COLD - Polygonal Collision Detection
toggy
19
Years of Service
User Offline
Joined: 6th Jun 2005
Location: Serbia
Posted: 12th Jul 2005 11:23
To GreenFox:

Try this example.You got a castle and camera(FPS-engine).Put yor
character in the camera coordinate and camera push back to chase the player.
This code uses Sparky collision DLL and it works nice.
Any question at: [email protected].
Good luck!
Toggy.

Attachments

Login to view attachments
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 12th Jul 2005 11:50
@ blanky, your idea doesn't work, sorry, possibly because my castle is a 3D X file object that I load into the game, scale, and position.
Thanks anyway.

@ RUCCUS, I dont know how to code that stuff, can you please do it for me if its not too much work?

Enjoy Life while your still alive.
Enjoy a recees anytime!
Hop a long
21
Years of Service
User Offline
Joined: 12th May 2004
Location: The Code Dump
Posted: 14th Jul 2005 05:45
Fox

To get started, try something simpler than your castle. Once you can collide with a box, you use the same idea for all the walls.
Metrion
19
Years of Service
User Offline
Joined: 8th Jul 2005
Location: In the darkest cave
Posted: 23rd Jul 2005 05:13
Try using Sparky's Collision DLL... it's really helpful, and is almost better than Nuclear Glory's Collision DLL.

Login to post a reply

Server time is: 2025-05-22 19:58:56
Your offset time is: 2025-05-22 19:58:56