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.

Newcomers DBPro Corner / Collisions don't work and I have no idea why

Author
Message
steampowered97
9
Years of Service
User Offline
Joined: 3rd Mar 2015
Location:
Posted: 27th Mar 2015 18:28
I loaded a map made in FPSC into a world in the code editor first. Since I don't know of any other way to do it, I decided to make a bunch of boxes whose edges match the walls of my map (its not very efficient I feel, but its not a very large map). If someone has an easier way to do this it would be much appreciated. Anyway, when the player, a sphere, runs into the map's wall (and the wall of the box), it's supposed to stopped from going through. But it goes right on through. As far as I can tell, the collision code is the exact same as other programs I've made where they worked.
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 30th Mar 2015 05:31
What I would suggest is that you use the Sparky's collision DLL. Here is a link to the thread where you can get it for free:

http://forum.thegamecreators.com/?m=forum_view&t=74762&b=5

Sparky's is faster than DBP's native collision. You could set this FPSC world up as a complex object and should be able to move through it with decent collision. There is a bit of a learning curve with Sparky's at first, but if you stick with it to learn it, you will wonder how you did without it. I have done a couple of FPSC to DBP worlds and it works for that.

So many games to code.....so little time.
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 30th Mar 2015 13:02 Edited at: 30th Mar 2015 22:38


For this piece of code, is the same as doing set object collision to boxes 10, as numColBoxes is set to 10 you do not need a for next cycle for 1 object only



Here, you only need to check collisions between object 3 and 10, so you don't need for a for next cycle



Here, why do you create a second camera if you are not using it?


Here, why do you scale an object to a negative value?
Also, you should use the sync command before the loop, not at the top of the do loop cycle.
steampowered97
9
Years of Service
User Offline
Joined: 3rd Mar 2015
Location:
Posted: 30th Mar 2015 19:18
@LBFN I tried this, but the plugin requires that the map be a .X file and I can't convert it due to low video memory (256mb on this machine). Thanks though.

@Cescano
1st snippet: I plan on making more boxes later, so I set up the code to make things easier down the line.

2nd Snippet: That makes sense, but the program should still end when it detects the collision. That's why the "end" is there, so I can see if it ever triggers into that loop, which it did not (until the scale were fixed).

3rd snippet: Residue from older versions. I guess I did not do a good enough job of cleaning up my code lol.

4th snippet: That is a great question... and actually what was messing everything up apparently.

There must be a sync in the do loop right? The one before the loop isn't necessary though.

I believe that I found a way to do this far more efficiently though with help from a demo. I'll post back if I do.
Your help is much appreciated!
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 30th Mar 2015 22:35
Yes it doesn't make any difference if is at the start or at the end of the loop, but the sync command is used before the loop and not after the do so that your code is more logical, it's not only important that your code works but that your code is readable as well, this will reduce the risk of making bugs when you will add more code.

Reading the code now I see that the code actually works because you are moving your object after registering the coordinates, I use to record old values at the start of the loop and after the movements i use to record the actual coordinates, in this way I am able to detect also static collisions, but if you are not planning to use them you can stick with your 3 coordinates without using new and old values
steampowered97
9
Years of Service
User Offline
Joined: 3rd Mar 2015
Location:
Posted: 31st Mar 2015 04:37
I tried using the demo "First Person Game" and using my map on it. The floor collisions work flawlessly, but the walls do not. Playing around with this bit:

when the cmx# line is commented out, I'm free to move along the x axis with the occasional ability to move along z a bit. Commenting out the cmz# does the same with the opposite axis. Commenting both out leaves a tiny area to move around in. Not sure what is going on here, or where its getting the collisions.
Here's the full program:
steampowered97
9
Years of Service
User Offline
Joined: 3rd Mar 2015
Location:
Posted: 31st Mar 2015 04:54
Oooh never mind it works now! I made the original start position and reset position a bit higher. Maybe it was running into the ground or something.

Login to post a reply

Server time is: 2024-04-19 09:47:09
Your offset time is: 2024-04-19 09:47:09