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

How to get sliding response to collisions (voxel terrain, mini-voxel camera)

4 posts in this topic

My collision detection seems to work well. Responding to it, however, does not. My terrain is made of cubes. My player is made of a cube. They are all axis aligned. As my terrain is divided up into cubes, I simply check to see if every corner of the player's cube is in empty space or a solid block. If even one is in a solid block, then I know a collision has occurred.

I'm wanting to slide the player along the plane of the collision, but I'm having some difficulty understanding how to identify the plane to slide on and how. Everything I've tried so far seems to have issues determining the exact plane to slide on/propel from.

As the picture below demonstrates, from one frame to the next, if the red square moved from bottom up as the arrow points, I need something to show that the bottom face of the black square is what was collided with (or the top face of the red square).

 

phOST.png

Edited by Mythix
0

Share this post


Link to post
Share on other sites

Are the cubes all the same size (as in, say, a voxel representation)? Let's say your player cubes are larger than some of your terrain cubes. Then, your test that only checks the containment of the corners will be insufficient. The player cube could entirely surround a terrain cube such that no corner is inside a terrain cube but the cubes would still volumetrically overlap. For example, see below....the player cube corners denoted by 'p', and terrain by 't':

 

                                      p---------------------------------------p

                                      |                                                |

                                      |              t--------------t               |

                                      |              |                 |               |

                                      p-----------|--------------|------------p

                                                     |                 |

                                  t---------------t--------------t---------------t

                                  |                  |                 |                  |
                                  |                  |                 |                  |

                                  t---------------t--------------t---------------t

 

One approach to deciding which plane to slide against would be to consider the outward-facing surface normal of all the faces of the colliding cubes. The collision/contact plane will be a plane between two cube faces whose normals point in opposite directions. The bottom plane of the black cube points down and the top plane of the red cube points up....opposite directions, so the bottom plane of the black cube would be your collision/contact plane.

 

grhodes_at_work

0

Share this post


Link to post
Share on other sites

My terrain is made of cubes. My player is made of a cube. They are all axis aligned. As my terrain is divided up into cubes, I simply check to see if every corner of the player's cube is in empty space or a solid block. If even one is in a solid block, then I know a collision has occurred. I'm wanting to slide the player along the plane of the collision

 

If we are at the voxel defined physics, this physics has an extreme advantage over subject physics. First let see what the cubes should do when they collide. A fundament of physics, in general is, that a subject has a tendence=speed vector by which it travels (or would travel) if no forces are being applyed on it. What is a force and why it start to apply later. In our case of the two cubes, lets consider that there are no attraction forces and the two cubes move their tendence as shown in the picture. If you know where they have the mass center located (innertia vector), you can tell perfectly what they will do now. Consider innertia tensor at the center of cube, for both of them.In your example you have a perpendicular angle, but one of the corners of the two cubes will be the first to call force. cubes are close and a force is created on the detecting corner, a point in space. After this,  innertia of cubeA , innertia of cubeB and the point of collision forms two vectors, which are know all suficient for direction of incoming tendence on the cubes individualy. But the size of tendence donation is unknown. Size of tendence donation is computed from weight of the donating object. It seems strange, but it is so, that speed doesnt matter and that the objects dont know eachother mass. But in virtual world you know their mass'. If the cube A is 1000 times havier than cube B. cube.A will add to its tendence 1/1000 of cube B tendence and cube B will add to its tendence 1000 of cube A tendence. After this, they move by their new tendence until collision point happens again.  the corners are sufficient information to produce exact connection point, which of course does not have to be on a corner. In our case, very soon another connection point may be triggered, but the innertia tensors got moved a bit by new tendence in time, and the slightly different directions compute this time, which results in sliding effect in time.

0

Share this post


Link to post
Share on other sites

Once you detect intersection, you must find the surface normal of the voxel.. This can easily be done on-the-fly using gradient analysis by averaging the positions of all empty voxels surrounding the intersected voxel (edit: in a 3x3x3 area, relative to the intersected voxel), normalize that vector, and 'push' the intersecting object back out along that calculated surface-normal so that the intersecting object is 'corrected' to the surface - yielding a 'sliding' effect when the object collides with the voxel volume.

 

you might want to also create an elastic effect (for certain entities) which simply 'reflects' the object's velocity by the surface normal, perhaps simply have an 'elasticity' entity property value, which determines the ratio of slide-to-bounce.

 

the velocity of the colliding object will also need to be corrected, in a similar fashion.

Edited by radioteeth
0

Share this post


Link to post
Share on other sites

oh, and this would be for fine-grained voxel simulations. If you are simply using cubes to represent your world, then you simply need to find what side of the voxel the object is intersecting, and push out along one of the six cube-normals.

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