Page 1 of 1

Collision detection with zoomed/rotated Sprite3D

Posted: Sat Sep 18, 2010 12:49 pm
by Fluid Byte
I know that PB's sprite collision works for Sprite3D as well but what if they are zoomed or rotated?

Do I need to write my own collision detection?

Re: Collision detection with zoomed/rotated Sprite3D

Posted: Sat Sep 18, 2010 1:27 pm
by Thorium
Fluid Byte wrote: Do I need to write my own collision detection?
Yes.
Maybe we can team up on that if you have pixel collision in mind.
I am currently working on a "proof of concept" for a very fast pixel collision test. It works with collision maps. For rotation, zoom, etc. the collision maps would need to be rotated, zoomed, etc.

Re: Collision detection with zoomed/rotated Sprite3D

Posted: Wed Sep 22, 2010 3:55 pm
by mpz
Hi Thorium,

at first you can make a rotated, zoomed, etc. collision map. The second step is to make a collsions detection. The follwing code helped my very much for my collision detection. Perhaps you can make it faster with a ASM code :mrgreen: .

www.gamedev.net/reference/articles/article735.asp
http://creators.xna.com/en-GB/tutorial/ ... 2dperpixel

best regards
Michael

Re: Collision detection with zoomed/rotated Sprite3D

Posted: Wed Sep 22, 2010 4:12 pm
by Thorium
mpz wrote:Perhaps you can make it faster with a ASM code :mrgreen: .
Yes. In fact a lot faster.
I allready have coded it without rotation and zoom. But it am currently on debugging it because it does not work correctly. But thats just a matter of mistakes i did, the system works very well.

It does not test pixel by pixel. It generates a collision map in which 1 bit represents 1 pixel. That allowes to test multiple pixels with just one compare. The goal is to test 128 pixel at once using the XMM register. However i just did the prototype in PB code. Once it's working i am rewriting it in asm and use the XMM register.