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 / Object Collision And FPS Levels

Author
Message
Delacroix
20
Years of Service
User Offline
Joined: 11th Jan 2004
Location:
Posted: 12th Jan 2004 01:38
Hi, I'm new to arkbasic and I was hoping someone might be able to help me understand a problem I'm having with Darkbasic Classic.

I was messing around with some of the tutorials and came up with the code that's attached to this post. My problem is that every time I try to implement collision detection I end up having the frames per second lowered from about 35 to 45 FPS to about 5 FPS.

For example I would do the following:

IF Object Collision(10,0)>0
Position Object 10,X#,0,Z#
ENDIF

But as I said that lowers the FPS considerably. I've tried putting it in the events themselves instead of just inside the loop, for example:

IF Upkey()=1 AND Spacekey()=0
IF Object Collision(10,0)>0
Position Object 10,X#,0,Z#
ENDIF
Move Object 10,-5
Loop Object 10,2,23
Set Object Speed 10,20
ELSE
Stop Object 10
ENDIF

But of course that doesn't work either. It will keep the frame rate working properly as long as you don't try to go forward. The minute you do however, it drops the frame rate again. I've tried different things and ended up with either the bad frame rate, the player's model/object not being able to move forwards or backwards at all or else the collision detection won't work at all.

It could be my computer but I don't understand why it wouldn't be able to handle this code when I've run other examples and games with little trouble.

If someone could please help me understand why the collision detection won't work I would very much appreciate it, thanks.

_./-''-._
| Sieg |
-:_.._/:-
nuclear glory
20
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 12th Jan 2004 07:25
Greetings,

It may just be DBC. Its collision system has always been a bit rocky.

Since your testing collision against cubes, you could write some of your own math routines for collision. (where you test your object against each cube)

Also, feel free to check out our collision system. It works for externally loaded meshes as well (for worlds, etc...)

Link to our site is below.

All the best

Lead Programmer/Director
Powerful Collision DLL for DBPro: http://www.nuclearglory.com
Delacroix
20
Years of Service
User Offline
Joined: 11th Jan 2004
Location:
Posted: 12th Jan 2004 19:22
Ok, thanks for the info.

_./-''-._
| Sieg |
-:_.._/:-

Login to post a reply

Server time is: 2024-09-21 15:57:16
Your offset time is: 2024-09-21 15:57:16