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

How to determine velocity after a collision?

4 posts in this topic

Hi,

I am working on a simple hockey game and I have come to the stage where I need to handle collisions between the puck and the ice, boards, posts etc. What I need help with is how do I determine the velocity after a collision? The velocity is a vector and I have a method for reflecting it which means the puck will bounce. However right now when a puck is shot high in the air and eventually drops down onto the ice again it will bounce and reach approximately the same height on each bounce (if I ignore air resistance). As anyone who watches hockey knows the puck hardly bounces at all (for simplicity I will assume the puck always lands flat) when it hits the ice. How do I calculate this loss of velocity? Do I need to calculate energy loss or something? Any help would be appreciated, not sure what to google for. If I need to provide more information let me know.
0

Share this post


Link to post
Share on other sites
I can't recall the technical terms, but I believe your issue is about physics materials. Your puck seems to be acting like a rubber ball with 100% elasticity. I gather that a puck would have a very low elasticity, e.g. 5%. This means that every collision 95% of the motion in the direction of the collision normal would be transferred to the object that it collides with. In the case of collision with the ground, you can assume that energy is just lost because The Earth Is Very Heavy (TM). The other 5% would turn into bounce. For practicality you may choose to zero out the vertical component if it's under a small amount.
0

Share this post


Link to post
Share on other sites
I did some more googling and managed to find something called Coefficient of restitution: [url="http://en.wikipedia.org/wiki/Coefficient_of_restitution"]http://en.wikipedia...._of_restitution[/url], perhaps this is what you were referring to? It says:

[quote]
For an object bouncing off a stationary object, such as a floor:

[img]http://upload.wikimedia.org/wikipedia/en/math/c/0/b/c0b72b848dd7fbf58ab4e2568a9ea053.png[/img]

, where

[img]http://upload.wikimedia.org/wikipedia/en/math/9/e/3/9e3669d19b675bd57058fd4664205d2a.png[/img] is the scalar velocity of the object after impact
[img]http://upload.wikimedia.org/wikipedia/en/math/7/b/7/7b774effe4a349c6dd82ad4f4f21d34c.png[/img] is the scalar velocity of the object before impact
[/quote]

Some more googling led me to this document [url="http://www.dissertations.wsu.edu/Thesis/Spring2008/R_Anderson_042308.pdf"]http://www.dissertat...rson_042308.pdf[/url], it says:

[quote]
[size=3]Vertical drop tests to determine the puck’s coefficient of restitution (COR) have been performed and found COR values in the range of .45-.55 at room temperature and .12-.27 for frozen pucks [1]. [/size]
[/quote]

[size=4]The average found at 25° F (~ -3.9° C) was apparently 0.267 so I will try to use this number. Is it as simple as to just calculate:[/size]

[size=4]v = 0.267 * u?[/size]

[size=4]In code I get the following:[/size]

[size=4][CODE]/* Collision with ice. */
/* iceNormal and velocity are of type Vector3. */

/* Normalize the normal of the ice i.e. (0,1,0) */
iceNormal.Normalize();

/* Reflect the velocity vector so that the puck bounces up again. */
velocity.Reflect(iceNormal);

/* Calculate velocity after collision, v = Cr * u */
velocity = 0.267 * velocity;
[/CODE][/size]

[size=4]The result looks pretty good, does this look correct to any of you guys? [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img][/size]
0

Share this post


Link to post
Share on other sites
I have looked around a bit more and I've seen examples of implementations where only the vertical component of the velocity vector is affected by the coefficient of restitution; the horizontal component is only affected by friction. Is this correct? If so my code above is incorrect and it would explain why my puck slows down so much horizontally when it bounces. But I am not sure the angle of the bounce is correct if only the vertical component is affected by COR. Could anyone clarify this please?

The last line above would be this instead:
[CODE]
velocity.Y = 0.267 * velocity.Y;
[/CODE]
0

Share this post


Link to post
Share on other sites
I imagine that Cr would be affected by shape and thickness, so it bounces much less vertically than horizontally because it's thin and flat in that direction. Make sense?
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