• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Hotwire

Mad approach for collision detection

3 posts in this topic

Hello
 
Problem:
 
I have a surface which is given by eq. F(x_i)==0 and I have a point y. And I want to know if it is inside or outside. 
 
2D case. 
Let's move to complex plane first. Create a function f which has a single pole right at point y
 
f(z)=1/(z-y)
 
Then evaluate the integral 
 
\int_\gamma f(z) dz 
 
along the curve \gamma that is given by eq. F(x_i)==0.
 
Because I know the answers for both cases(outside and inside), just looking at the sign I'll solve my problem. It works for both convex and noncovex curves
 
3D case
We make a 2d slice. Then make the same procedure. For convex surfaces it will be enough to use just one slice, for nonconvex surfaces... 
it's a real mess but seems to be possible(from just mathematical point of view). One slice is still enough but we can have much more contours then one.
 
What do you think about that? 
 
p.s. It was my childhood dream to create my own physics engine, now I am theretical physicist but i still want to )))




 

0

Share this post


Link to post
Share on other sites

Sounds mad indeed.

Have you tried it in real code yet?

 

You would probably want to avoid heavy use od divisions because they're very costly in terms of cpu cycles.

I don't know if this approach works for games though...

0

Share this post


Link to post
Share on other sites

I don't think that anything with "evaluate the integral" in it has a realistic chance of working as a collision system (unless the curve is a particular special case for which you can hardcode an easy closed form solution).

 

Usually you want something that works realtime or at least kind-of-realtime, and the algorithm is invoked for a few hundred or thousand objects. Evaluating a few thousand integrals of "some" function isn't precisely a lightweight operation. Of course, there may be cases where you simply don't care how long it takes...

2

Share this post


Link to post
Share on other sites

I have a figure which is given by array of triangles and I have couple of points that i know for sure that they are inside my figure and I have my testing point. I build a plane with these three points.

 

Now I need to extract the curve that was created by the slice. 
First of all I need to seperate the triangles that really contribute to curve. if all three points are on the one side they don't contribute
 
I'll switch the coordinate system and check if z coordinates for all point are greater then zero or less. (one dot product+sum per vertex)
 
If triange intersects the plane I can easily find the solution to this intersection.(at least 4 dot products for one triangle)
 
My curve is a polygon. It is not hard to integrate along this curve. 
 
One can easily see that during the separation (for convex figures) I will make 3 times more operations that one may need for the answer. But probably it's a reasonable price to pay to collide non-convex polygons



 

0

Share this post


Link to post
Share on other sites

You can use LaTeX here. Just enclose your code in \ ( and \ ) (without the spaces) for inline math, and \ [ and \ ] for display math. For instance \( \int_0^\infty e^x ~ \mathrm{d} x \).

 

Seems to me that you don't really need to compute the full path integral, since you only require its sign. You can do much better. If your curve/surface is closed and bounded you can use the even-odd theorem, which basically says that if you draw a ray from your point to infinity in any direction, the point is inside the curve if and only if it intersects the curve an odd number of times. This rule works for any (nondegenerate) curve or surface, convex or not. Note this is an if and only if condition, so one ray is enough to decide (and, in fact, it is transitive, in the sense that if the segment between point X and point Y has an even number of intersections, then X and Y are both inside or both outside). This is really just evaluating the sign of the aforementioned path integral, but much easier to implement because it doesn't require the concept of an integral and transforms the problem into a ray-surface intersection problem for which efficient solutions are known.

 

If your curve is simple, you can probably intersect it analytically with a line. If it is sufficiently well-behaved and you have a scalar field of it available, like in your first post, you can bisect to find intersections, which is at least tractable, if not terribly efficient. Otherwise, you can always raycast or raymarch, possibly using an acceleration structure. In practice, faster algorithms are used for the broad phase, while more sophisticated algorithms are used to resolve collisions accurately between polygons (narrow phase) often by splitting them into convex polygons beforehand.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0