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 / Terrain collision

Author
Message
GreenDixy
16
Years of Service
User Offline
Joined: 24th Jul 2008
Location: Toronto
Posted: 16th Mar 2010 17:06 Edited at: 16th Mar 2010 17:09
Started with gdk a bit ago now and i am trying to set it up so the player can walk and follow the ground here is the error



Here is the terrain simple basic terrain



Here is the player setup i appreciate any help possible on allowing the char to walk on the terrain.



Edit: Forgot to add i do have #include "SC_Collision.h" in the files

===================
No life, Lots of love, 2 Kids, God save me LOL
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 16th Mar 2010 22:02
The SC_SetupObjectComplex is a typing mistake, the correct function name is SC_SetupComplexObject.

However, if you want to set up a terrain, then the best function to use is probably SC_SetupTerrainObject. (Unfortunately the help file mentions this function as SC_SetupTerrainCollision, but in the header it has a different name.)
GreenDixy
16
Years of Service
User Offline
Joined: 24th Jul 2008
Location: Toronto
Posted: 17th Mar 2010 02:30
so i tried "SC_SetupTerrainObject" says to use the complex command but when i use that i can still walk through the terrain with my char

===================
No life, Lots of love, 2 Kids, God save me LOL
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 17th Mar 2010 08:55
It's not enough to just set it up, you also need to check collision somehow (e.g. with raycasting down from the position of the character) and then, if there is a collision, reset the coordinates of your character to move it back to a collision-free position. I haven't yet used Sparky's with terrain, so the most I can advise you is to study the Sparky's examples and the help file and try to figure it out.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 17th Mar 2010 19:18
Another suggestion, this occurred to me after the previous post: You don't necessarily need collision just to walk around on the terrain. There is a function dbGetTerrainGroundHeight, which tells you the height of the terrain at a given position. You can then adjust the vertical coordinate of your character with the height value. Have a look at the terrain demo which comes with Dark GDK, it is doing the same and it's simple.
GreenDixy
16
Years of Service
User Offline
Joined: 24th Jul 2008
Location: Toronto
Posted: 17th Mar 2010 19:42
thanks Mireben i will check it out and post back you have been a great help

===================
No life, Lots of love, 2 Kids, God save me LOL
GreenDixy
16
Years of Service
User Offline
Joined: 24th Jul 2008
Location: Toronto
Posted: 17th Mar 2010 20:04


This is the section you where talking about correct?

===================
No life, Lots of love, 2 Kids, God save me LOL
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 17th Mar 2010 20:08 Edited at: 17th Mar 2010 20:09
Yes, that's it. I hope it will be useful in your program.
(If you have third person view, just substitute character position instead of camera position.)
GreenDixy
16
Years of Service
User Offline
Joined: 24th Jul 2008
Location: Toronto
Posted: 17th Mar 2010 20:46
currently i am using a third person view but thinking of switching it to normal view dunno thoe i think for not it would be a little more easier to do normal view

===================
No life, Lots of love, 2 Kids, God save me LOL
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 18th Mar 2010 01:11
I hope you don't mind me plugging my physics/collision plug-in but here goes.

What you are doing is correct but you may eventually want the character to not go up steep slopes or to fall off cliffs, the method you are using wont allow for that.

There are a couple of collision/physics plug-ins currently being developed, my one(link in my sig) and QuickODE by Pauli, these will give you those features, whats better though is that when you add stuff to your terrain(buildings, trees etc) these plug-ins will give you sliding collision automatically.

Anyway, I would keep doing it the way you are right now but maybe keep these in mind for the future.

But if you do try my one, you should would wait for the update at the weekend.

GreenDixy
16
Years of Service
User Offline
Joined: 24th Jul 2008
Location: Toronto
Posted: 18th Mar 2010 02:13
@matty halewood

Thanks i will have a look into it i am still learning so right now its just basic stuff. I have my model walking with animations so far the terrain is in place etc, Just a few things i need to setup before i can move forward.

===================
No life, Lots of love, 2 Kids, God save me LOL
Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 18th Mar 2010 22:36
you can do that with sparkys collision too. only its not automatic as matty said... you need to get the collision normals and then calculate the slide point.. etc etc... you can see how it functions in the slide sample...

hi

Login to post a reply

Server time is: 2024-11-20 03:47:27
Your offset time is: 2024-11-20 03:47:27