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.

DarkBASIC Professional Discussion / FPS Map Collision Problem

Author
Message
Master SeePlusPlus
13
Years of Service
User Offline
Joined: 30th Dec 2012
Location:
Posted: 11th May 2014 20:09
Hello,

I have started to create maps in FPS Creator and importing them into DBPro. All has been going well. I got the mechanics for my game down (which will be a horror maze game) and things are looking good.. except for one huge problem.

The collision for my FPS map is completely off. For some reason, the bottom part of the ground has normal collision, so that is fine. However, the upper part of the ground will make you collide with it (using automatic camera collision 0,1,0) at least 40 units ABOVE the ground.

I can include code if necessary, but I do not know if that would help. ANY response would be greatly appreciated, thanks!
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 12th May 2014 01:12
Quote: "the bottom part of the ground has normal collision, so that is fine. However, the upper part of the ground will make you collide with it (using automatic camera collision 0,1,0) at least 40 units ABOVE the ground."


Does you level have several floors? What do you mean with the upper part of the ground ? is that a terrain perhaps ?. Can't you scale your map ?

If you could include some functional code to test ... and your map.

Cheers.

I'm not a grumpy grandpa
Master SeePlusPlus
13
Years of Service
User Offline
Joined: 30th Dec 2012
Location:
Posted: 12th May 2014 01:27
Here is the bulk of what is needed:

Basically, hold space to be able to wander where you want.
My level does not have several floors. By upper part of ground, I mean I am using strictly a level ground and if you hold space to go under where the ground is you will hit the top like normal collision, but there is 40 units of space of the ground you cannot hit. It is scaled. I also will attach files needed, just extract to same folder as this code.


chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 12th May 2014 02:00 Edited at: 12th May 2014 02:43
I'm on it....testing your level, but what I see is just a floor. You haven't got any gravity in the movements, so you keep flying. I will test it with one of my levels and will report you back.

Cheers.

Edited.
Automatic camera collision doesn't do miracles here. You need to add a collision system. That's why you stay flying , and automatic collision works kinda box collision. Here's an example with collision that you can use just loading your level.



I'm not a grumpy grandpa
Master SeePlusPlus
13
Years of Service
User Offline
Joined: 30th Dec 2012
Location:
Posted: 12th May 2014 03:16 Edited at: 12th May 2014 04:28
Yeah I did not have gravity, I was keeping the camera at the same height the whole time until I got the jist of it down. I'll test your collision and see what I can do. Thanks, will edit this with results.

EDIT: Thank you so much. I was able to figure out how to implement this into my game. It is so much easier to use this than regular auto collision.

EDIT2: The Jumping is a little awkward.. i.e. if you let go you plummet down as if gravity were much stronger. How do I fix that.
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 12th May 2014 12:20
Quote: " The Jumping is a little awkward.. i.e. if you let go you plummet down as if gravity were much stronger. How do I fix that."


We can adjust the jumping smooth modifying the gravity value, and the
( keystate(57) ) when we press Spacekey: change this piece of code

Quote: "rem colision de camara con el fondo
if static volume(cox#,coy#-10,coz#,cmx#,cmy#-10,cmz#,1.0)=1
materialtype=get static collision value()
cmx#=cox#+get static collision x()
cmy#=coy#+get static collision y()
cmz#=coz#+get static collision z()
grav#=0.2
else
inc grav#,0.2
endif

rem salto
if tkeystate57=1
cmy#=cmy#+2
endif
"


Here's the complete code:




Cheers.

I'm not a grumpy grandpa
Master SeePlusPlus
13
Years of Service
User Offline
Joined: 30th Dec 2012
Location:
Posted: 12th May 2014 18:52
Yeah I modified those on my own to numbers I felt fit the environment of the game, but I mean for jumping you must hold space the entire time for the jump effect to work. If you let go of spacebar, you plummet back to the ground quickly. Been trying to fix this for a long time haha.

Thanks.
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 12th May 2014 19:21
Quote: "but I mean for jumping you must hold space the entire time for the jump effect to work. "


If we hold spacekey, we don't stop jumping

Doesn't it work when you pres spacekey ?...has you solved yet ?

I'm not a grumpy grandpa
Master SeePlusPlus
13
Years of Service
User Offline
Joined: 30th Dec 2012
Location:
Posted: 12th May 2014 19:46
If you let go of spacekey you stop jumping, that is the problem but it is fine. I won't worry about that.


However, one huge problem is if you jump while running into a wall. You fly!
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 12th May 2014 21:54
Quote: "However, one huge problem is if you jump while running into a wall. You fly!"


I tesded right now, and you are right , you climb walls ...that is bad. I could find a solution, but as I mentioned in the snippet, I found this piece of code in The Game Creator forum. Let me see.

You could use Sparky's collision, that works great, and is free. Let me know if you need any help.

Cheers.

I'm not a grumpy grandpa
Master SeePlusPlus
13
Years of Service
User Offline
Joined: 30th Dec 2012
Location:
Posted: 12th May 2014 22:17
I do have Sparky's collision installed, but I cannot find a list of commands. If you could just let me know where commands are I will try to create my own.

Thanks
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 12th May 2014 22:34
Here's an example of sparky collision with a level. You can find too the help files folder with all commands.

I'm not a grumpy grandpa

Login to post a reply

Server time is: 2026-07-06 10:02:21
Your offset time is: 2026-07-06 10:02:21