Collision Detection and Resolution

All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
 41 views
of 14

Please download to get full document.

View again

Description
Collision Detection and Resolution Collision Detection Determining if and when two objects collide is not as simple as it might initially seem. Collision detection is…
Share
Transcript
Collision Detection and Resolution Collision Detection Determining if and when two objects collide is not as simple as it might initially seem. Collision detection is very costly because, fundamentally, every object should be tested against every other object for a possible collision, which is O(n2) time complexity The main difference overlap testing and intersection testing Overlap testing detects whether a collision has already occurred. Intersection testing predicts if a collision will occur in the future. Overlap testing Most common technique, yet exhibits the most error. At every simulation step, each pair of objects will be tested to determine if they overlap with each other. If two objects overlap, they are in collision. This is known as a discrete test since only one particular point in time is being tested. The goal is to test if any part of an object is inside any part of another object. Results of collision detection The time the collision took place. The collision normal vector (to prevent the objects from further interpenetrating. Collision Detection and Resolution Collision Detection Overlap testing Bisection technique Collision Detection and Resolution Collision Detection Overlap testing Limitation of overlap testing It fails horribly when objects move a little too fast. For overlap testing to always work, the speed of the fastest object in the scene multiplied by the time step must be less than the size of the smallest collidable object in the scene. Collision Detection and Resolution Collision Detection Intersection testing The defining characteristic of intersection testing is that it predicts future collisions before they happen. Intersection testing must test the geometry of an object swept in the direction of travel against other swept geometry. Whatever geometry the object is composed of, it must be extruded over the distance of travel during the simulation step and tested against all other extruded geometry. Collision Detection and Resolution Collision Detection Intersection testing Sphere intersection testing Calculation1: Collision: t0 < t < t1 Calculation 2: Collision: d < (rp + rq ) Collision Detection and Resolution Collision Detection Intersection testing Limitation of intersection testing One important problem arises in networked games, because of network packet latency. One more potential problem for intersection testing is that it assumes a constant velocity and zero acceleration over the simulation step. Collision Detection and Resolution Dealing with Complexity Two significant challenges in performing these calculations in real time. Testing complex geometry for containment (overlap) or visibility (intersection) is complicated and computationally costly. Solution: substitute simpler geometry, and initially test rough approximations of each object. A naïve collision-detection implementation is O(n2) time complexity, since every object must be tested with every other object. Solution: techniques to achieve nearly linear time complexity in the number of objects. Simplified Geometry If a complex object can be roughly approximated with a simpler shape, testing will be cheaper. Collision Detection and Resolution Dealing with Complexity Simplified Geometry Minkowski Sum By taking the Minkowski sum of two convex volumes and creating a new volume, it is possible to determine overlap by testing if a single point is within this new volume. Collision Detection and Resolution Bounding Volumes In modern 3D games, each game object is constructed with hundreds or thousands of polygons. An object’s volume is defined by these polygons, but testing this complex volume is too expensive in most cases. The solution is to use bounding volumes when approximate collision detection suffices, or use increasingly complex bounding volumes when accuracy matters. A bounding volume is a simple geometric shape, like a sphere, that fully encapsulates an object, which is an approximation of the object’s shape. If there is no collision with the bounding volume, it is known that there is no collision with the object. If the bounding volumes of two objects collide, this indicates that there could be a collision. Common bounding volumes: Sphere: represented by a position and a radius, with no need for an orientation, test by distance between 2 sphere centers. Box: Axis-Aligned Bounding Box (AABB) Orientation Bounding Box (OAB) If an object is complex, it is often possible to fit several bounding volumes around its unique parts. Muti-level bounding boxes from coarse to detailed Collision Detection and Resolution Achieving O(n) Time Complexity The world is partitioned with a simple grid, each object must only be tested against objects in the same or neighboring grid cells. Potential problems: large sized objects vs. grid size, objects concentrated in few grids Plane sweep This method leverages the temporal coherence of objects to roughly stay in the same location from frame to frame, thus reducing the problem to linear O(n) time complexity. The idea is to record the bounds of every object on each of the three axes. Any objects that have overlapping bounds in all axes should be examined more closely for a collision. Collision Detection and Resolution Terrain Collision Detection Collision detection with terrain is often a special case. Particular objects, like characters, must usually stay in contact with the terrain, so detecting the collision of each foot with the ground is very important. Position of character’s foot: above terrain, on/at terrain, in/below terrain (displayed on terrain) In most games, the terrain is defined as a polygonal mesh. A height field is a uniform triangle mesh where the x- and z-coordinates of each vertex are fixed in a grid, but the y-coordinate (height) of each vertex can vary, thus creating 3D terrain in a simple manner. Collision Detection and Resolution Terrain Collision Detection Triangulated Irregular Networks (TINs) If the terrain is a nonuniform polygonal mesh, built by displacing vertically the vertices of a 2D mesh, we can still simplify the problem by treating the terrain as a 2D mesh projected into the xz plane. Given a point Q with a fixed x- and z-component, it can only lie on a single triangle of the terrain. The problem is identifying the correct triangle. barycentric coordinates Collision Detection and Resolution Collision Resolution Simple case: The position of the objects at the time of collision must be calculated, to place them in the correct location at the time of impact. and, new resulting velocities must be imparted onto the objects. Procedure of collision resolution Prologue When collision resolution begins, the collision is known to have occurred, but there is a chance that it should be ignored, and collision event notification being sent. Collision The objects will be placed at the point of impact and new velocities will be assigned using physics or some other decision logic. Epilogue Any post-collision affects must be propagated Resolving overlap testing Resolving intersection testing Collision Detection and Resolution Collision Resolution Resolving overlap/intersection testing Four steps to resolving the collision when overlap testing is used: 1. Extract the collision normal. 2. Extract the penetration depth. (overlap only) 3. Move the two objects apart to a penetration depth of zero, if needed. (overlap only) 4. Compute the new velocities.
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks
SAVE OUR EARTH

We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

More details...

Sign Now!

We are very appreciated for your Prompt Action!

x