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 / Cube colision help needed

Author
Message
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 21st Jan 2005 00:33
I have coded colision boundaries on a cube so that the player(camera) cannot go through it. The trouble is that on one corner, the sliding colision transition is rough. On the other side it is smooth.
Down below are two diagrams to help you identify what I mean.

These Diagrams represent the top of the crate, as if looking straight down from above the crate.
Diagram 1 is how I currently have the colision coded, the areas of colision detection being the area inside each set of red lines. The problem with Diagram 1 is that when the player approaches it's ends, seeing that they are cut off by the depth of side A's colision area, the player is then placed where it should be when within side A's area of colision. This makes for a very rough go-around the corner from side B to side A. Now, from side A to side B is fine, seeing that it's ends meet with the crate's ends.
Diagram 2 is a theory of mine that I know would work if I knew how to code it. Is Diagram 2 possible to code, or do you know of another way to code cube colision that works equally on each side?
I have attached my source code for this function.

+NanoBrain+
Ali M Oldboy
20
Years of Service
User Offline
Joined: 6th Nov 2004
Location: England, UK
Posted: 22nd Jan 2005 04:14


Ali M

†††[ -- LoSt DrEaMs -- ]†††
Hop a long
21
Years of Service
User Offline
Joined: 12th May 2004
Location: The Code Dump
Posted: 22nd Jan 2005 10:17
Nano
Very interesting. Are you using DBC? Why did you choose math collision instead of using a DB function? Not that you can't but it's jumping into the deep end of the pool if you are just beginning.

I'm not attempting to answer your question since I can't see your code. But on the off chance you haven't seen the DBC function check out this:http://www.geocities.com/hifin2003/sliding-collision.html
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd Jan 2005 23:22
Yes he's using DBC, look what board this is. And math collision is way more efficient than DB's collision functions in classic.

Nano, try this snippet.
http://www.thegamecreators.com/?m=codebase_view_code&i=67ac560245c9b4822f6e288ba7137bd4

It's in DBC, and collision detection and response only take 3 lines of code.

"eureka" - Archimedes
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 25th Jan 2005 15:11
Yes, I am using DBC. I wish to use math collision for two reasons. One, because I will not always have functions to guide me the way through when I wish to produce my own code for games and/or applications in DBC or any other language. Therefore, I do it in experimentation, being a serious wanna-be good programmer. Also, I have not used them, but have heard that the DBC collision functions take a huge bite out of frame rate, mostly because they have to calculate the collision for each object and not just the ones needed. Don't know for sure, but I would rather not take the time to find out.
Now, that you know a little about me, has anyone happened to come to a conclusion in this post? Nice to meet you all, by the way, and thank you for responding to my still, small voice of a post.
By the way, Ali M, you made me laugh. Though dissapointed at the same time, your "code snippet", due me a surprise LOL. Thanks for that, at least.

+NanoBrain+
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 25th Jan 2005 15:34
Whoops, didn't see that you two gave me links to try out. I am looking at them both. Thank you two.

+NanoBrain+
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 26th Jan 2005 00:59
Phaelax, I have studied your code and it works well. It is also much more efficient than the way I was trying to code the collision of objects in general. I will be using the method for now on. Thank you.

+NanoBrain+
Hop a long
21
Years of Service
User Offline
Joined: 12th May 2004
Location: The Code Dump
Posted: 27th Jan 2005 09:32 Edited at: 27th Jan 2005 09:43
I admire your determination. And your outlook is mature.

Quote: "I wish to produce my own code for games and/or applications in DBC or any other language. Therefore, I do it in experimentation, being a serious wanna-be good programmer."


Maybe you will like this math collision tutorial:http://www.nuclearpublishing.com/hosting/emperorbaal/
(Be sure to click on the tutorial link.)
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 27th Jan 2005 14:04
Hop A Long,
Thank you for the admiration. I took a short look at your link and will definitely, when I am not in a rush, study it. It contains some very useful math knowledge from what I saw when skimming over it.

+NanoBrain+
Hop a long
21
Years of Service
User Offline
Joined: 12th May 2004
Location: The Code Dump
Posted: 28th Jan 2005 10:39

Login to post a reply

Server time is: 2025-05-24 03:39:25
Your offset time is: 2025-05-24 03:39:25