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 / 3D Collision maths??

Author
Message
Manga Tiger Boy
15
Years of Service
User Offline
Joined: 24th Aug 2009
Location:
Posted: 15th Oct 2010 08:36
Aaaargh!!!

For a good 8 hours I've been trying to figure out simple gravity; you see, a flat playfield isn't enough for me. I need simple maths for collisions with another object file. I don't want to use Sparky's Collisions (mainly because of all the glitches involved every time I try to use it). 3D is WAY much more difficult than 2D, but I like a challenge. But sometimes enough is enough, and here I am, asking you smartz ppls. Thanks in advance!

N3wton
15
Years of Service
User Offline
Joined: 3rd Jun 2009
Location: Leeds, UK
Posted: 15th Oct 2010 12:21
You could always get Box2D physics and wrap it for use with DarkGDK...

That or, I tend to go for sprite collision if it's 2d, then to implement gravity I'd use either, a simple

if( object != on_ground ) object.y -= gravity.

or if I was feeling more mathsy, i'd use project equations...

object.y = vtcos(a) = (gt ^ 2) * 0.5 + h;
object.x = vtsin(a);

where v = velocity, t = time, g = gravity; h = initial start height

So basically there's loads of different ways to do collisions and gravity etc... it all depends on the project.

I hope I have helped a little bit

Yours
N3wton

N3wton
15
Years of Service
User Offline
Joined: 3rd Jun 2009
Location: Leeds, UK
Posted: 15th Oct 2010 12:23
and I just realized you said you weren't doing 2D XD I just saw 2d and presumed

for 3D, you could use a 3D physics engine, (PhysX, Havok) there are loads of them but them two are two that I have seen working with the GDK...

Otherwize your kinda stuck to sparkys...

yours
N3wton

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 15th Oct 2010 17:20
fulcrum physics might be the thing you're looking for (search this board for it)

[url][/url]
Nothing's impossible, it's just a matter of time...
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 15th Oct 2010 22:27
People don't code their own collision engines because its hella hard to do so

Well... its hard to create a fully functioning collision engine. If you just want to walk on a terrain, that's not too hard. First, find what triangle your character is standing on. Then interpolate the height between the points, and position your character vertically based on that height.

Also Sparky's has never been buggy for me, so I'd say its probably how you're coding.

Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 21st Oct 2010 02:16
Don't take this the wrong way, but I honestly think it's more of a user error if you're encountering glitches in sparky's. I've used sparky's ever since i've been using DarkGDK, and i've done gravity, collision with walls, sword collision, walking on a terrain etc, I even do all the buttons in my GUI's with sparky's, and it works perfect every time. It's not something that you can say copy and paste the code from the demo's and expect it to work just like that, it's something you have to spend some time figuring out how to use it properly. I'm sure most of the veteran programmers from this board will tell you the same thing. Not trying to be rude or anything, just trying to save you programming your own collision system when there's an excellent one at your finger tips.

Just an example, in the last game I was working on I was trying to implement this AI library, and I couldn't figure out how to get it to work without glitches, so I abandoned it and tried to write my own. I had limited success but then when I went back I discovered how to make that AI system work for me and have used it great ever since. Just goes to show you that maybe it your understanding of the code thats off and not the collision library.

Login to post a reply

Server time is: 2024-09-28 16:30:38
Your offset time is: 2024-09-28 16:30:38