Strange effect whit pixel collision using 3d

Previous topic - Next topic

mentalthink

Hi there,

I put here, because I don´t know if this it´s a bug...

Well I have this problem, I have a world 3D, it´s a background, and I have the 2D layer upper the 3D layer,
when I made a simple Pixel perfect collision between 2 sprites, the speed decrease a lot of, and I stay very sure it´s the SPRCOLL command, because I use BOXCOLL and the speed don´t down nothing, perhaps the collision, confuse somthing whit the 3d background.

Another point, very strange, is, when you make a only one collision the game ralentize, but don´t turns to the initital speed...  :S :S

Slydog

Is your SPRCOLL command done when you are in 2D mode?  ie:
Code (glbasic) Select
X_MAKE3D
...3d stuff
X_MAKE2D
SPRCOLL . . .


If it is, try doing the 2D first (I know, it will be UNDER the 3D stuff) for a test:
Code (glbasic) Select
X_MAKE2D
SPRCOLL . . .
X_MAKE3D
...3d stuff


If that works and doesn't slow you down you could always do the 2D twice, with the 1st time doing no rendering.  ie:
Code (glbasic) Select
X_MAKE2D
SPRCOLL . . .
X_MAKE3D
...3d stuff
X_MAKE2D
... draw sprites


Other than that, I don't know why it would slow you down.
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Kitty Hello

what texture size do you have? SPRCOLL has to check EVERY pixel of the overlapping rectangle (unless there is a collision, which speeds things up).

Also, SPRCOLL has to "glRead" the alpha pixels for the texture whenever you changed it. (USESCREEN, LOADSPRITE, GRABSPRITE, MEM2SPRITE). That's a huge bottleneck - don't do that for every frame if there's any other way.

mentalthink

Thanks Gernnot, very usefull the technical explanation, well I solved use a simple Boxcoll, at this momment it´s the better and faster solution...

Kinds Regards,
Iván J