• 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
alterecho

Normal n of surface to calculate impulse

4 posts in this topic

Hi,

I'm trying to use the equation from Wikipedia ([url="http://en.wikipedia.org/wiki/Collision_response"]http://en.wikipedia....lision_response[/url]) to find the impulse of a collision. How do i find the surface normal n, which is a unit vector?
0

Share this post


Link to post
Share on other sites
One easy way to get the normal of any 3D surface, is to create two vectors from three points on the surface. When you have the two vectors simply take the cross product of them, and normalize it.

In 2D you'll get the normal by creating a vector from two points (a and b) on the surface. Then find the orthogonal vector and normalize it:
v = (b.x - a.x, b.y - a.y)
ortho = (-v.y, v.x)
n = normalize(ortho)
0

Share this post


Link to post
Share on other sites
Ideally, you will use Vertex normals (take a weighted average of the normals of all adjacent triangles sharing the vertex at that point). This is easier to calculate if the surface is on a regular grid. For polygon soup you may not know all of the triangles that share that vertex.

If it is as a parametric surface, the normal at u,v is (basically) the cross product of the vectors: (u,v)->(u+delta,v) and (u,v)->(u,v+delta) where delta is the tolerance, normally based on the surface sample resolution.

But for starters, just use the polygon normal (normalized cross product of two edges of the nearest triangle). Edited by Catmull Dog
0

Share this post


Link to post
Share on other sites
I apologize for the late reply.

I am now calculating the normal to the surface by finding the velocity of the contact point and then normalizing that velocity. This does seem to give me the normal for that surface of contact. Is this right?
0

Share this post


Link to post
Share on other sites
[quote name='alterecho' timestamp='1345345189' post='4970987']
I am now calculating the normal to the surface by finding the velocity of the contact point and then normalizing that velocity. This does seem to give me the normal for that surface of contact. Is this right?
[/quote]

No. The normal doesn't depend on the velocities etc of the colliding shapes, just their shapes.

Also - you're not looking for the "surface normal" - a property of just on of the contacting surfaces. You need to contact normal, which is a property of both surfaces.

You need to explain in more detail what you're trying to do. Giving a complete answer for the 3D case will be a waste of time and largely irrelevant if you're just concerning yourself with circles in 2D. However, the general result is: the contact normal you're looking for is the direction of the reaction forces in the case of zero friction (yes, that only helps when you know the answer... but by imagining what would happen in the zero friction case you might be able to work out what the normal must be).

For some contacts this is trivial - e.g. for a sphere/circle it will always be in the radial direction. For a contact with a face in 3D (whether a box or part of a triangle mesh etc) it will always be normal to the face. For an edge in 2D it will always be normal to the edge (you can think of a circle being made up of an infinite number of edges).

Basically in 2D, where you only have edges and corners, you need to consider only edge-corner contacts, which are trivial. You can ignore corner-corner contacts, and edge-edge contacts can be converted to two edge-corner contacts.

In 3D you have to deal with faces, edges and corners. Anything contacting a face results in the face's normal. If two edges contact take the cross product of the edges. Ignore corner-corner and corner-edge contacts.

If you already have the shapes penetrating, then a reasonable option is to take the direction that minimises the overlap/penetration distance. Edited by MrRowl
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