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 problems with 3D world studio

Author
Message
DarthVader 335
17
Years of Service
User Offline
Joined: 18th May 2007
Location: Cyberspace
Posted: 4th Apr 2009 20:09 Edited at: 5th Apr 2009 18:10
I'm working on making a simple fps game and I've gotten movement down and loading the world, but when I try collision it works on the outside of the map but when I noclip inside it it teleports me outside of it. I found out that its a issue with the collision model on the .dbo file I'm using as the map. Anyone know how I can fix this?



EDIT:
ok im using sparkys collision system now how would I use that for simple FPS style collisions?

The only limit to creating video games is your imagination
teltak
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location:
Posted: 6th Apr 2009 02:58
im having this same problem. i can't figure out how to stop running through walls. so i guess its ths camera collison thing then.

but just a guess try moving the dbAutomaticCameraCollision to different cordinates.
DarthVader 335
17
Years of Service
User Offline
Joined: 18th May 2007
Location: Cyberspace
Posted: 6th Apr 2009 06:28
I was going through the sliding collision sample and it looks like sparkys doesn't use the auto camera collision. You have to add a sphere,cube or w/e and constantly moves its position to the cameras position but I'm sure there's another way that's just what I've observed through looking at the code. I'm going to post what i get working on here.

The only limit to creating video games is your imagination
DarthVader 335
17
Years of Service
User Offline
Joined: 18th May 2007
Location: Cyberspace
Posted: 6th Apr 2009 07:52 Edited at: 6th Apr 2009 20:39
Ok i figured it out its actually not that hard.

To start you'll need 3 functions...
void MakePlayer()
void MovePlayer()
void PositionCameraToObject(int obj)

first we'll need some variables above our function declarations first.



MakePlayer is probably the simplest we'll use.

All the function does is create a sphere and position it in the world and setup its collision properties.



MovePlayer is where the magic happens.
First we set it to rotate the player object based on the mouse movement.



Then we create our position variables



Next we create our keybindings I'm not exactly sure how the Cos and sin comes in but it works lol



Now we create our collision variables


Now heres the real collision code!



I don't fully understand exactly what its doing so I wont try and explain it.

after all of this we just use the last 2 lines



Now we're all done with our player movement function!

Lastly we will create our camera function



All it does is position the camera to the player object and rotate the camera based on the objects rotation.

Now we'll work on our main loop.

First we'll have the basic functions



now we'll create a "world" what you do is create a object or load a .dbo or whatever model you want to use. example.



now we call our player function


now in your GDK loop we'll have these lines


After you run all of this you should have a nicely running basic movement/collision system! heres the full bit of code!



I hope this helped if i made any mistakes please let me know and ill correct it!

NOTE: I wouldn't recommend just copying and pasting the bit of code at the end, Type it once look at it and understand what its doing. (the sparkys help file has all the commands and what to pass to them and what they do this is just to show the structure)

The only limit to creating video games is your imagination
MVKiller
20
Years of Service
User Offline
Joined: 1st Oct 2003
Location:
Posted: 6th Apr 2009 11:52
How have you guys found managing all those ID's? I created some simple Sprite classes to wrap db* functions so that I don't have to worry about the iD number for every call but I don't see many people up here doing that kind of thing?
DarthVader 335
17
Years of Service
User Offline
Joined: 18th May 2007
Location: Cyberspace
Posted: 6th Apr 2009 20:33
If this was a larger project instead of just having 2 objects I'd just make a int variable and name it Map or Gun and give it a value of the object number I want it to be. Seems to be a little easier than writing your own class just to get rid of having to enter a number.

The only limit to creating video games is your imagination

Login to post a reply

Server time is: 2024-09-30 23:14:57
Your offset time is: 2024-09-30 23:14:57