pixel-perfect c.d.

Started by
4 comments, last by Marmin 18 years, 12 months ago
How would one implement pixel-perfect collision detection in Directx8 (ortho mode)?
Advertisement
Create a collision mask for each texture with 1's and 0's and apply logic to see if two masks intersect. Do a rectangle test first though of course. Also if you can rotate the sprite this will not work and another method like polygon representation may be preferred.
------------------------See my games programming site at: www.toymaker.info
That does seem the fastest and most logical way to do. Accessing the pixels is very slow I guess.
Why don't used D3DXMatrixOrthoOffCenterLH which takes the screen width and Height then you can position your Coord at normal 2D Coordinates and still be able to do rotation using The Matrix Transformation that D3D provides and stuff. Then you can use simple 2d bounding box equation for the collision.
Also try to take a look at this library: BitMask. I'm sure you can do a little messing with it to get what you need. I've yet to use it yet, but I do know of a few libraries as well as projects it has been used for.
Quote:Original post by BornToCode
Why don't used D3DXMatrixOrthoOffCenterLH which takes the screen width and Height then you can position your Coord at normal 2D Coordinates and still be able to do rotation using The Matrix Transformation that D3D provides and stuff. Then you can use simple 2d bounding box equation for the collision.
I don't understand a heck regarding the whole D3DXMatrixOrthoOffCenterLH to be honest.
It gives a black screen, whatever I do. Do I have to set a camera matrix? I feel like smashing my screen right now: because the MSDN information is as usual wayto short.

This topic is closed to new replies.

Advertisement