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.

Dark GDK / Object Collision

Author
Message
sificvoid
15
Years of Service
User Offline
Joined: 13th Dec 2008
Location:
Posted: 21st Dec 2008 12:54
Im trying to set up a game level with a generated terrain. There will be various creatures throughout (hoping to use some type of spawn-in system) and various buildings in specific locations that you can enter. The problem I am currently having is with object collision. First I tried setting it up manually with dbMakeObjectCollisionBox, dbSetObjectCollisionOn, and dbSetObjectRadius. Then, I tried working with the AutoCollision commands and GlobalCollision. I fear my noobism has got the best of me, any help would be appreciated!

The following snippet uses resources found in the DGDK tutorials if you wanna fire it up


I am new to this, but I am confused as to whether I should post in the Newcomers forum. Considering that it is titled 'DB Newcomers', and I am using GDK. Could someone clarify whether or not I should post my 'GDK Newcomer' questions there?
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 21st Dec 2008 14:59 Edited at: 21st Dec 2008 15:01
First, don't use the built-in collision, use Sparky's:

http://forum.thegamecreators.com/?m=forum_view&t=74762&b=5

Secondly, are you trying to make collision with the terrain? If so the easiest way is to cast a ray down/up from your player, find the distance to the terrain, then moving your player down/up by that much every frame. This method isn't perfect but it should work for now.

Oh, and nah you probably shouldn't post GDK questions in the Newcomers board; it's fine to post em here even if they're very simple.

study
15
Years of Service
User Offline
Joined: 12th Dec 2008
Location:
Posted: 21st Dec 2008 17:43
Do you mean we can always use Sparky's collision instead of built-in and its better too?
i want to start working with collisions too, if Sparky's are better then i don't need to work with built-in functions for collision right? is sparky's collision complete for me?
thanks
prasoc
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 21st Dec 2008 17:56
Sparky's collision is amazing. around 10 lines of code I got sliding collision working, whereas the default collision is "sticky" where you cant move when you collide with something
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 21st Dec 2008 18:16
Yep, Sparky's collision can basically be thought of as a replacement for DBP/DGDK collision; it can do everything plus more, and faster too.

study
15
Years of Service
User Offline
Joined: 12th Dec 2008
Location:
Posted: 21st Dec 2008 21:07
I try to understand object collision system but i can't. i have only two objects in 3d space with id 1 and 3, i only want to find collision when it happens. I wrote codes for them like this:

and in main while loop it cheks for object one if it has collision. so i wrote this code to see is there collision for object 1 or not.

but i see only number 0 on screen while object 1 and 3 have collision too.
what is my problem? should i use any other codes for collision system?
Thanks
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 21st Dec 2008 22:41
Your code looks fine to me, have you had to scale or fix rotate your models at all?

Try using box collision, then SC_DrawObjectBounds() and see what you get.
study
15
Years of Service
User Offline
Joined: 12th Dec 2008
Location:
Posted: 22nd Dec 2008 01:41
Thanks matty
My Object is Rotate with mouse ( this is from my top-down game ) and moves with keyboard arrows.
i use'd the code you said and i see my object moves with keyboard but my collesion box is fix and don't moves with object
study
15
Years of Service
User Offline
Joined: 12th Dec 2008
Location:
Posted: 22nd Dec 2008 01:50
Ow i find protblem, SC_UpdateObject() needs to fix it.
but still main problem is not solved!
study
15
Years of Service
User Offline
Joined: 12th Dec 2008
Location:
Posted: 22nd Dec 2008 01:56
after zoom out camera i saw Colonel-X.X bounds is near of the object not on it, and it's not as big as object too. i think this it causes problem. how can i fix the object to this collision box?
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 22nd Dec 2008 10:14 Edited at: 22nd Dec 2008 10:14
If you have scaled your object use this.

SC_AllowObjectScaling(int obj); //takes object scaling into account in collision calculations

I also have trouble with some models, try searching this board for sparkys.
sificvoid
15
Years of Service
User Offline
Joined: 13th Dec 2008
Location:
Posted: 26th Dec 2008 07:03
Just wanted to say thanks andrewT. I got sparkys plugin and Ive got some results with it.

Login to post a reply

Server time is: 2024-09-30 13:31:44
Your offset time is: 2024-09-30 13:31:44