Advertisement

Pixel - Pixel collision detection with LPDIRECT3DTEXTURE8

Started by May 23, 2002 02:34 PM
3 comments, last by MaTZ 22 years, 8 months ago
I''m doing game like GTA. I use orthogonal matrix in D3D8, so everything is in one layer. How can i make pixel to pixel collision detection when i have 2 cars (different textures - LPDIRECT3DTEXTURE8) that are turned in different angles ???
There is a posibility of generating a bitmap (2d array of 1''s and 0''s) by alpha values of you car''s image and then simply checking if the 1''s (they mean the point is not transparent - the car) are overlaping, sadly this just doesn''t go for rotations.

---
Keep it simple, stupid
---Quite soon...ICQ: 163187735
Advertisement
Just my two cents -

I much prefer shape-to-shape collision detection with algebra and let the graphics be rendered independently. (You would have an algebraic shape that is similar to the graphics for the car, that lends itself well to collision detection with other algebraic shapes)

A 2D game can definitely get by with checking for graphics overlaps for collision detection, as long as the end game runs the same frame rate on all machines. In my own personal programming, though, algebraic collision detection evolves itself into the various other paradigms (i.e. 2D to 3D programming) much more smoothly.

See if you can use algebraic collision detection easily, to avoid the troubles of getting graphic collision detection to work. If not, at least keep it in mind for later projects.

Good luck! Sorry I couldn''t offer any advice on answering your particular question.
It's not what you're taught, it's what you learn.
But I think that shape to shape collision detection isn''t too good for this game. For example try to describe formulas shape by rectangles.
ummm, x1, x2, y1, y2? i am failing to see how bounding boxes would not be good? do a search on the forums on rect to rect collision detection. i, as a few others had a discussion on collision detection with bound boxes (ie rectangles) that are rotated about the center at aribtray angles (ie exactly what you are doing). no need for pixel collision maps.

older games used bounding boxes exclusivly since per pixel collision detection was too resource (ram, cpu) intensive.

This topic is closed to new replies.

Advertisement