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 / Collision help

Author
Message
Shiawase
14
Years of Service
User Offline
Joined: 23rd Jan 2010
Location:
Posted: 23rd Jan 2010 21:39
I've been trying to follow the sliding demo included in sparky's collision, and so far nothing is really working. The character still goes through other objects and the terrain. I don't know if it's because the terrain isn't a .x file(I used terrain tutorial in the dark dgk tutorial folder) and/or if the fact that the character flies and gravity doesn't/shouldn't really apply to it.

So anyway, here's the code:


Any help would be very much appreciated. Thanks in advance.
Christopher Reeves
18
Years of Service
User Offline
Joined: 20th Dec 2005
Location: Texas, USA
Posted: 25th Jan 2010 15:12
Hi there. I just started using Sparky's collision system and it's pretty good. By looking at your code the first thing that kinda jumped out at me was that you're applying collision detection on your skybox? I don't know if that would be neccessary...but anyway...

Honestly what I have found was that scaling complex objects seems to be a problem in Sparky's collision system right now. Even if you scale them before you make the call to SC_AllowObjectScaling() you will still end up with some very spotty collision and all other sorts of wierd things happening.

I say this because I kept having a problem with collision in my game until I stopped scaling the worlds and what not.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 25th Jan 2010 19:38
I don't have much experience with collision either but here are a few tips for you.

You do not call SC_UpdateObject anywhere. When you move or scale an object, you need to call this, otherwise the collisions will be checked for their old position and size. So if you load an object and position it, then after positioning call this function, and also call it for your moving (player) object every time after it is moved.

Your indexes are a bit mixed. For example, you load object number 4, then set up for collision object number 3. Then you load object 5 and set up 4... What the code does may be correct but it is difficult to follow and debug if the operations are not in a logical order.

An index error might be in your main loop as well. If the moving object is number 6, then why do you check object position for number 2? (That is the skybox.)

These lines:



will not make any difference if the vx, vy and vz variables are all set to zero a few lines above. I'm not sure about using old x and z values in the spherecast check either, shouldn't they be old and new values, before and after movement?

You call SC_GetCollisionSlideX/Y/Z functions, but according to Sparky's help, this should not be used together with simple sphere cast collision check because it does not return accurate sliding data. The SC_SphereSlideGroup command should be used instead of SC_SphereCastGroup, if you want sliding collision.

I hope this helps a bit, but as I said, I'm not an expert on Sparky's and haven't used it yet in a real application, so I was just trying to spot places where something could go wrong.
tvzen
14
Years of Service
User Offline
Joined: 3rd Dec 2009
Location:
Posted: 25th Jan 2010 22:04 Edited at: 25th Jan 2010 22:04
here is the one i use


so it could be
Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 26th Jan 2010 09:06
the SC_AllowObjectScaling() does work. first you setup the object, then you allow scaling, then you scale it, then you update the object. and for the terrain question, the collision system Sparky uses is not made for terrains. so you must make your terrain in another program like 3D world studio and export it to a known format, like DBO. then, just use:

dbLoadObject(terrain.dbo,1);
SC_SetupComplexObject(1,1,2);

there are other methods of checking for collision in a terrain, like the dbGetTerrainGroundHeight command. use your imagination

hi
Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 26th Jan 2010 09:12
i looked at the help files included with Sparkys collision system.
use: SC_setupTerrainCollision(1,1,1);



hi

Login to post a reply

Server time is: 2024-10-01 23:37:40
Your offset time is: 2024-10-01 23:37:40