Page 1 of 1

Routine for any collisions

Posted: Mon Mar 09, 2009 8:02 pm
by gnasen
Hi folks,

I read very often that something like a collision routine is missing, so I decided to write my own. I hope it is as easy to use as I tried to make it.
There are 3 testprograms (with source) and a documentation in the package.

Features:
-create any polygons as hitbox
-move and rotate hitboxes
-very fast check if hitboxes collide
-easy to use with pb like syntax
-linux and windows compatible, 64bit not checked yet
-create hitbox out of a sprite

Download: http://wwwhomes.uni-bielefeld.de/ddiffe ... lision.zip

Little, good readable example with awesome graphics:
Image

Sandbox editor:
Image

Performance check:
Image

Posted: Thu Mar 12, 2009 12:28 am
by gnasen
I improved the speed of the collision checks and got a speedboost of 50% on different collisions and more then 600% if there is no collision between some triangles (which are part of every hitbox).

Have fun. Would be happy about some further testing. And maybe some Feedback :wink:

new Download:
see first post.

new speedcheck
Image

Posted: Thu Mar 12, 2009 12:35 am
by White Eagle
Danke

Posted: Thu Mar 12, 2009 10:58 pm
by luis
Very nice!

I just tested without trying to understand the code for now, don't have time ATM.

But thank you very much for sharing it, I certainly will look into it.

Posted: Sat Mar 28, 2009 12:22 pm
by gnasen
added a requested function to create a hitbox out of a sprite. So its very easy to create hitboxes.

col_import(sprite,transcolor,gridsize)

transcolor is the not solid area, gridsize the "scan resolution".

Have fun

Posted: Sat Mar 28, 2009 12:45 pm
by eddy
read very often that something like a collision routine is missing,
me too

ok I will integrate one to my sprite lib :D

Posted: Fri Sep 04, 2009 7:05 pm
by Rook Zimbabwe
Looks interesting! Will try it with my particle system.

Re: Routine for any collisions

Posted: Sun May 10, 2020 11:08 am
by wombats
It might be a bit of a long shot, but does anyone still have this? I don't think it's on RSBasic.de.

Re: Routine for any collisions

Posted: Mon May 11, 2020 9:21 am
by Demivec
wombats wrote:It might be a bit of a long shot, but does anyone still have this? I don't think it's on RSBasic.de.
I do. I am not quite sure if I have the latest version though. The link in the first post was a zip and mine is a rar.

I looked over the code and updated it to PureBasic v5.72 so it is runnable and changed variables from .l to .i for example. I also increased the readability a little with some added returns and spaces. I finished it all up by zipping it and placing it on DropBox.

Here's the link. It will be available for a while though I may eventually remove the link to it.

Re: Routine for any collisions

Posted: Mon May 11, 2020 10:26 am
by wombats
Demivec wrote:
wombats wrote:It might be a bit of a long shot, but does anyone still have this? I don't think it's on RSBasic.de.
I do.
Thank you!