Pixel Perfect Collision Detection DirectX 9 VB.NET
Pixel Perfect Collision Detection DirectX 9 VB.NET
Pixel Perfect Collision Detection DirectX 9 VB.NET
Pixel Perfect Collision Detection DirectX 9 VB.NET
Pixel Perfect Collision Detection DirectX 9 VB.NET
Pixel Perfect Collision Detection DirectX 9 VB.NET Pixel Perfect Collision Detection DirectX 9 VB.NET Pixel Perfect Collision Detection DirectX 9 VB.NET Pixel Perfect Collision Detection DirectX 9 VB.NET Pixel Perfect Collision Detection DirectX 9 VB.NET Pixel Perfect Collision Detection DirectX 9 VB.NET Pixel Perfect Collision Detection DirectX 9 VB.NET Pixel Perfect Collision Detection DirectX 9 VB.NET
Pixel Perfect Collision Detection DirectX 9 VB.NET Pixel Perfect Collision Detection DirectX 9 VB.NET
Pixel Perfect Collision Detection DirectX 9 VB.NET
Go Back  Xtreme Visual Basic Talk > > > > Pixel Perfect Collision Detection DirectX 9 VB.NET


Reply
 
Thread Tools Display Modes
  #1  
Old 02-29-2004, 12:45 AM
gideon_kain gideon_kain is offline
Newcomer
 
Join Date: Feb 2004
Posts: 2
Default Pixel Perfect Collision Detection DirectX 9 VB.NET


I am trying to create pixel perfect collision detection between what some people call "textured quads" made by vertex buffers..basically 2 triangles with a texture on them.

how can I say to my engine:

If a non-transparent color from the texture on quad A is overlapping with a non-transparent color from quad B then....etc,etc?

I have looked through seemily every post and no one gives a straight answer just directs you to Rook's DirectX 7 example

Can anyone help, this is driving me crazy

here's my sprite rendering subroutine,

Code:
Private Sub renderSprite() For n = 0 To MaxSprites - 1 spriteWidth(n) = 46 spriteHeight(n) = 48 spriteX(0) = 50 spriteY(0) = 50 If spriteX(MaxSprites - 1) < iWidth Then spriteX(MaxSprites - 1) += spriteSPD Else spriteX(MaxSprites - 1) = -(spriteWidth(MaxSprites - 1)) End If If spriteY(MaxSprites - 1) < iHeight Then spriteY(MaxSprites - 1) += spriteSPD - 1 Else spriteY(MaxSprites - 1) = -(spriteHeight(MaxSprites - 1)) End If If bAnimate = True Then If frameCount < frameRate Then Select Case frameCount Case 1 To frameIncrement spriteU(MaxSprites - 1) = 0 Case (frameIncrement + 1) To (frameIncrement * 2) spriteU(MaxSprites - 1) = 0.166 Case (frameIncrement * 2 + 1) To (frameIncrement * 3) spriteU(MaxSprites - 1) = 0.332 Case (frameIncrement * 3 + 1) To (frameIncrement * 4) spriteU(MaxSprites - 1) = 0.498 Case (frameIncrement * 4 + 1) To (frameIncrement * 5) spriteU(MaxSprites - 1) = 0.664 Case (frameIncrement * 5 + 1) To frameRate spriteU(MaxSprites - 1) = 0.83 End Select Else frameCount = 1 spriteU(MaxSprites - 1) = 0 End If End If Dim theGeometry As New Geometry(D3DDev, ColorFormat) 'Sets vertex Buffer variable equal to class default (box) vbSprite = theGeometry.vbSprite 'Set all positions in vertex buffer Dim vSprite As CustomVertex.TransformedTextured() = CType(vbSprite.Lock(0, 0), CustomVertex.TransformedTextured()) 'Calculate positions of sprite theGeometry.CalculateSprite(vSprite, spriteWidth(n), spriteHeight(n), spriteX(n), spriteY(n), spriteZ(n), spriteU(n), spriteV(n)) D3DDev.SetStreamSource(0, vbSprite, 0) D3DDev.VertexFormat = CustomVertex.TransformedTextured.Format D3DDev.SetTexture(0, aniChrono_right) D3DDev.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2) frameCount += 1 Next

the calculatesprite sub is this

Code:
vSprite(0) = New CustomVertex.TransformedTextured(spriteX, spriteY, spriteZ, 1, spriteU, spriteV + 2 / spriteHeight) vSprite(1) = New CustomVertex.TransformedTextured((spriteX + spriteWidth), (spriteY), (spriteZ), (1), (spriteU + 0.166), (2 / spriteHeight)) vSprite(2) = New CustomVertex.TransformedTextured((spriteX), (spriteY + spriteHeight), (spriteZ), (1), (spriteU), (1)) vSprite(3) = New CustomVertex.TransformedTextured((spriteX + spriteWidth), (spriteY + spriteHeight), (spriteZ), (1), (spriteU + 0.166), 1) vbSprite.Unlock()

Now let's see some code!!!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Pixel collision Detection HotWire Game Programming 2 01-30-2004 12:58 PM
Problem with Pixel perfect collision... I really need help Kamochan DirectX 4 07-22-2003 08:40 AM
Collision Detection - Pixel by Pixel (not tile by tile) Virgo Game Programming 6 03-12-2003 04:09 AM
pixel perfect collision detection wyrd Game Programming 7 09-03-2002 12:49 PM
collision detection using pixel colours..ie getpixel andreww Game Programming 12 02-22-2002 11:14 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Pixel Perfect Collision Detection DirectX 9 VB.NET
Pixel Perfect Collision Detection DirectX 9 VB.NET
Pixel Perfect Collision Detection DirectX 9 VB.NET Pixel Perfect Collision Detection DirectX 9 VB.NET
Pixel Perfect Collision Detection DirectX 9 VB.NET
Pixel Perfect Collision Detection DirectX 9 VB.NET
Pixel Perfect Collision Detection DirectX 9 VB.NET Pixel Perfect Collision Detection DirectX 9 VB.NET Pixel Perfect Collision Detection DirectX 9 VB.NET Pixel Perfect Collision Detection DirectX 9 VB.NET Pixel Perfect Collision Detection DirectX 9 VB.NET Pixel Perfect Collision Detection DirectX 9 VB.NET Pixel Perfect Collision Detection DirectX 9 VB.NET
Pixel Perfect Collision Detection DirectX 9 VB.NET
Pixel Perfect Collision Detection DirectX 9 VB.NET
 
Pixel Perfect Collision Detection DirectX 9 VB.NET
Pixel Perfect Collision Detection DirectX 9 VB.NET
 
-->