Polygon Collision
Polygon Collision
Polygon Collision
Polygon Collision
Polygon Collision
Polygon Collision Polygon Collision Polygon Collision Polygon Collision Polygon Collision Polygon Collision Polygon Collision Polygon Collision
Polygon Collision Polygon Collision
Polygon Collision
Go Back  Xtreme Visual Basic Talk > > > Polygon Collision


Reply
 
Thread Tools Display Modes
  #1  
Old 04-06-2011, 05:20 AM
mindrage mindrage is offline
Newcomer
 
Join Date: Apr 2010
Posts: 2
Default Polygon Collision


Hello guy, Im making a advanced space shooter with DX, but im having a problem with polygonal collision detection.
I really dont know what i should use?
Could anyone provide code with convex polygons in VB6?

I've heard about MTV fixing for fixing positions. but dunno what would be appropriate?

I have a deadline for this project so can anyone if they have the time post asap?
Reply With Quote
  #2  
Old 04-06-2011, 02:22 PM
ZaCkOX's Avatar
ZaCkOX ZaCkOX is offline
Contributor
 
Join Date: May 2006
Location: CA
Posts: 645
Default

Use geometry to find the area of the shape. Then use it's coordinates and area to see if any are inside one another. You can loop through all of them with a true or false return function. Or you could return true and which ones are collided. Then you could bounce these off each other or whichever one was moving, just move that one, up to you.
__________________
ZaCkO ... Who is your attitude?
Reply With Quote
  #3  
Old 04-07-2011, 02:14 AM
mindrage mindrage is offline
Newcomer
 
Join Date: Apr 2010
Posts: 2
Default

thats the problem, im having it hard understanding the geometry, found some code samples, but cant trace it backwards since i dont know how to pass custom types throught classes.
Reply With Quote
  #4  
Old 04-07-2011, 02:34 AM
Rockoon's Avatar
Rockoon Rockoon is offline
Joseph Koss

* Guru *
 
Join Date: Aug 2003
Location: Unfashionable End
Posts: 3,615
Default

Declare the methods/properties/functions which use your custom types as 'Friend' instead of 'Public', and declare the custom type in a regular module.

The limitation is because all VB6 objects are COM objects, and COM simply doesnt support public user defined types in any official capacity (only via typeless pointers, which vb6 doesnt support)
Reply With Quote
  #5  
Old 04-07-2011, 07:02 PM
ZaCkOX's Avatar
ZaCkOX ZaCkOX is offline
Contributor
 
Join Date: May 2006
Location: CA
Posts: 645
Default

Quote:
Originally Posted by mindrage View Post
thats the problem, im having it hard understanding the geometry, found some code samples, but cant trace it backwards since i dont know how to pass custom types throught classes.
If you can find the area of a triangle and a rectangle or square, this should be a slam dunk. Did you miss out on geometry class? And if somehow z axis, you could do volume, simple enough. Or is it you don't understand the concept at all and just need us to give you it?
__________________
ZaCkO ... Who is your attitude?
Reply With Quote
  #6  
Old 04-12-2011, 04:30 AM
surfR2911 surfR2911 is offline
Contributor
 
Join Date: Oct 2009
Posts: 719
Default Convex polygon and related collision code

I know I'm a little late to the thread but I do want to note that if the original thread starter question is for DX then the Games Programming forum contains a special DirectX sub forum for DX-specific queries.

For others who may hot upon this thread when doing a search for "convex" I include this link:
VB6 - Find the convex hull of a set of polygon points.

Also possible useful for rolling your own polygon collision detection code:
VB6 - Determine whether a point is inside a polygon

If your polygon can be sub-divided into triangles then this DirectX4VB triangle-triangle collision code might be helpful (of course you didn't say whether you were trying to do 2D or 3D collision - for instance a platonic solid composed of polygons).

Last edited by surfR2911; 04-12-2011 at 04:40 AM.
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

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
Polygon Collision
Polygon Collision
Polygon Collision Polygon Collision
Polygon Collision
Polygon Collision
Polygon Collision Polygon Collision Polygon Collision Polygon Collision Polygon Collision Polygon Collision Polygon Collision
Polygon Collision
Polygon Collision
 
Polygon Collision
Polygon Collision
 
-->