![]() |
|
collision |
spork222
Member #7,263
May 2006
|
Hello all- I'm looking for a good collision detection library. I tried compiling pmask (under linux) but got the following errors: pmask.c: In function ‘install_pmask’: pmask.c:34: error: size of array ‘_compile_time_assert__’ is negative pmask.c: In function ‘init_pmask’: pmask.c:40: warning: unused variable ‘error’ pmask.c: In function ‘get_serialized_pmask_size’: pmask.c:105: warning: unused variable ‘words’ The other library that is available is ppcol, but that doesn't appear to be available anymore. Anyone able to provide any help or suggest a different collision library? |
ixilom
Member #7,167
April 2006
![]() |
I'm quite sure this is ppcol, happened to have it among my other "good to have" snippets =)
And the header ...
___________________________________________ |
spork222
Member #7,263
May 2006
|
Thanks |
orz
Member #565
August 2000
|
The compile_time_assert_ error message with PMASK there is because you compiled in an environment where "unsigned long int" is 64 bits, and pmask defaults to assuming that it's 32 bits. The third paragraph of the "PORTABILITY & PLATFORMS" section of the docs describes how to compile it in such an environment. PPCOL will, I believe, in such an environment, will silently use twice as much memory, with half of it being never-modified zeroes. edit: when writting my initial post I glanced at ixilioms, saw the "ppcol", and didn't read the quoted code. Now I notice that he didn't actually link to PPCOL, but instead quoted PPCOLs allegro-sprite-collision-checker. That code will probably work fine anywhere that Allegro works, though many people prefer the bitmask based functions offered by PMASK and PPCOL because they can be dramatically faster for medium-to-large sprites. |
spork222
Member #7,263
May 2006
|
Oh yeah... kinda forget about 64bit problems like that sometimes. Thanks, I will look at the docs more closely this time:-[ |
Francois Lamini
Member #7,791
September 2006
![]() |
This is kind of off the topic but one hint I can give you is to make all of your character move only by an interval of 4 and see if any of the tiles 4x4 are touching. Characters can vary their speeds by timing how often they move. The result is perfect collision detection with minimal effort. As of libraries that deal with collision detection I haven't heard of any, sorry. Francois |
|