Collision Detection In Computer Games - KTH

1y ago
11 Views
2 Downloads
6.55 MB
51 Pages
Last View : 15d ago
Last Download : 3m ago
Upload by : Joao Adcock
Transcription

Self-IntroductionCollision DetectionCollision Detection in Computer GamesFangkai Yang11 ComputationalScience and TechnologyKTH Royal Institute of TechnologyFangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionOutline1Self-IntroductionWho is Fangkai?2Collision DetectionLet’s Play a Game!Collision DetectionFangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionWho is Fangkai?Outline1Self-IntroductionWho is Fangkai?2Collision DetectionLet’s Play a Game!Collision DetectionFangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionWho is Fangkai?Who is Fangkai?DefinitionFangkai Yang is a crazy Gamer, Mathematician andProgrammer.PhD candidate in Computer Science.Research on Crowd-simulation andGame AI.Game developer: Just Cause 3(Avalanche Studios), War Rage(NetEase Games).Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionCollision Detection: A Gentle IntroductionCollision detection concerns the detection of collisions betweenobjects in the virtual environment. Primarily employed to stopobjects moving through each other and the environment.Collision Detection is everywhere in computer games: betweencharacters and characters, between characters and terrain, etc.Remember:Physical laws do not exist in the virtual world by default.Must computationally model and program them.Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionDayz StandaloneWhat my friends think I was playing:Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionDayz StandaloneWhat I was actually playing:Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionDayz StandaloneWhat I was actually playing:Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionFIFAWhat my friends think I was playing:Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionFIFAWhat I was actually playing:Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionBasic Geometry TypesRigid-bodiesHard objects (ideal solid bodies)Constant distance between vertices in the meshConvex vs. concaveSoft-bodiesCloth, for exampleMore complicated to simulateSoft-bodies like cloth may collide with themselvesFangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionBasic Geometry TypesFangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionBasic Geometry Typeshttps://www.youtube.com/watch?v M5Ygpxfmcg8Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionOutline1Self-IntroductionWho is Fangkai?2Collision DetectionLet’s Play a Game!Collision DetectionFangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionKing of Fighter 97I want a volunteer!Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionQuestion:How to test if a character has been hit?Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionOutline1Self-IntroductionWho is Fangkai?2Collision DetectionLet’s Play a Game!Collision DetectionFangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionCollision DetectionDefinitionCollision detection refers the detection of the intersection of twoor more objects.Figure: Collision detection in Street FighterFangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionFigure: Overlaps of characters.Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionHow about collision detection in 3D games?Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionPenetrationWhen collision is detected, the penetration follows.Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionTwo forms of collision detection:Continuous: very expensive. Simulate solid objects in reallife.Discrete: objects will end up with penetrating each other.Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionBacktrackingFangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionBacktrackingLike Tom Cruise in Edge of Tomorrow, it turns time backwardsand fix the penetration that occurred in the last frame.Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionBounding VolumeDefinitionBounding volume for a set of objects is a closed volume thatcompletely contains the union of the objects in the set.(a) In the game scenario.Fangkai Yang(b) In the physics engine.Collision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionBounding Volume typesBounding Box: Axis Aligned Bounding Box (AABB),Oriented Bounding Box (OBB), etc. For objects that restupon other, such as a car resting on the ground, using abounding box is a better choice.Bounding Sphere: They are very quick to test for collisionwith each other.Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionSphere Collision DetectionCircles are colliding if D (R1 R2)d is the distance between the circle centersR1 and R2 are the radii of both circles respectivelyFangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionAABB Collision DetectionRecall: Faces of an AABB are aligned with the coordinatesaxes.To see if A and B overlap, separating axes test can beused along the x,y and z axes.This is faster, as only need to search x,y and z axes.Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionSome ProblemsNaive collision detection approaches may simply test if twoobjects are overlapping at every time-step.Problem: quickly moving objects can pass right througheach other without detection(b) First test.Fangkai Yang(c) Second test.Collision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionSwept VolumeThe AABB in the game bounds not the object, but the SweptVolume of the object from one frame to the next.Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionBroad Phase and Narrow PhaseMost efficient implementations use a two-phase approach: abroad phase followed by a narrow phase.Broad phase: collision tests are based on boundingvolumes only. Quickly prune away pairs of objects that donot collide with each other. The output is the potentiallycolliding set of pairs of objects.Narrow phase: collision tests are exact they usuallycompute exact contact points and normals thus muchmore costly, but performed for only the pairs of thepotentially colliding set.Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionBroad PhaseFigure: Collision detection between AABBs (Axis Aligned BoundingBox).Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionBroad PhaseThe broad phase collision detection helps to filtrate thepotentially colliding object sets.The brute-force way is doing collision test for all pairs ofobjects, and the complexity is O(n2 ).(a) Sweep and prune.Fangkai Yang(b) Spatial subdivision.Collision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionNarrow PhaseSeparating Axis TestsMany algorithms are based on the separating hyperplanetheoremFigure: Two disjoint convex sets are separable by a hyperplane.Separation w.r.t. a plane P separation of the orthogonalprojections onto any line L parallel to plane normalFangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionSeparating Axis TestsThink of it like this: do a twist to simplify calculations.Separating axis is a line for which the projection intervals do notoverlap.Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionSeparating Axis TestsSeparated if Amax Bmin or Bmax AminQuestion:Which axes to be tested?Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionSeparating Axis TestsAxes to test:Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionConvex versus Convex Collision DetectionOne of the most commonly used algorithm in game engine isGJK (Gilbert-Johnson-Keerthi) algorithm. This algorithm relieson a support function to iteratively get closer simplices to thesolution using Minkowski difference.(a) Two shapes collide on one vertex.Fangkai Yang(b) No collision.Collision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionGJKGiven the two polyhedra:Computes the distance d between themCan also return the closest pair of points on each polygonsFangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionSupport Mapping FunctionSupporting point. This is an extreme point on the polygonfor a given direction d.The support mapping function returns this pointFangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionThe first simplex is built using what is called a support function.Support function returns one point inside the Minkowskidifference given two sets KA and KB .Figure: The first two vertices in the first simplex.Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionAn ExampleFangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionAn ExampleSelect direction d (1, 0):p1 (9, 9); p2 (5, 7); p3 p1 p2 (4, 2);Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionAn ExampleSelect direction d ( 1, 0):p1 (4, 5); p2 (12, 7); p3 p1 p2 ( 8, 2);Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionAn ExampleSelect direction d (0, 1):p1 (4, 11); p2 (10, 2); p3 p1 p2 ( 6, 9);Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionAn ExampleThe Simplex doesn’t contain the origin, but we know that thetwo shapes are intersecting. The problem here is that our firstguess (at choosing directions) didn’t yield a Simplex thatenclosed the origin.Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionAn ExampleSelect direction d (0, 1):p1 (4, 5); p2 (5, 7); p3 p1 p2 ( 1, 2);Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionAn ExampleNow we contain the origin and can determine that there is acollisionFangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionAn ExampleFangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision Detection(a) The first iteration. (b) New simplex doesnot contain the origin.(c) The second(d) New simplexiteration.contains the origin.Fangkai YangCollision Detection in Computer Games

Self-IntroductionCollision DetectionLet’s Play a Game!Collision DetectionThank you for Listening and Sleeping!Fangkai YangCollision Detection in Computer Games

Collision Detection is everywhere in computer games: between characters and characters, between characters and terrain, etc. Remember: Physical laws do not exist in the virtual world by default. Must computationally model and program them. Fangkai Yang Collision Detection in Computer Games

Related Documents:

5 1. Collision Physics – An Overview. 1.1 Outline. Collision physics includes ANY collision of a quantum particle with a target. Collision Particles may be: PHOTONS (eg from a Laser, Synchrotron source or FEL) ELECTRONS (usually of well defined momentum from an electron gun) IONS (usually from an ion source of well defin

The Games organised at Olympia led to the development of the Panhellenic Games. These included: - The Games at Olympia (Olympic Games): every four years - The Games at Delphi (Pythian Games), 582 B.C.: every four years (third year of each Olympiad) - The Games at the Isthmus of Corinth (Isthmian Games), from 580 B.C.:

Section 3: Playground Markings Games 16 Section 4: Skipping, Hula Hoop & Elastics 25 Section 5: Catching games 32 Section 6: Relay games 41 Section 7: Ball games 48 Section 8: Fun games 59 Section 9: Frisbee games 66 Section 10: Parachute games 70 Section 11: Clapping and rhyming games 74 Useful websites 79

Olympic Winter Games medals Olympic Winter Games posters Olympic Summer Games posters Olympic Summer Games mascots Olympic Winter Games mascots The sports pictograms of the Olympic Summer Games The sports pictograms of the Olympic Winter Games The IOC, the Olympic Movement and the Olympic Games The Olympic programme evolution Torches and torch .

Regional Games and Multi-Sport Games (such as Pan American Games, African Games, European Games, Commonwealth Games, Mediterranean Games, Francophone Games, Youth Olympic Games) International Tournaments organised by the IJF (Grand Prix, Grand Slam, Masters) or under its auspices (continental open and cups),

detection for a vehicle with the help of sensor and camera place in a vehicle. The design was made to analyze the collision detection and send the appropriate signal to the cloud platform for alerting the required rescue station based on the predicted location of the collision identified by the proposed algorithm.

collision, anti-collision protocols are used. Slotted Aloha is one of the main anti-collision protocols used with RFID. This thesis proposed a mathematical model and a simulator to analyze the performance of the Slotted Aloha protocol without interference. Tag detection is directly related to tag signal strength detected by the reader.

development of the International Standard and its recent publication, now, is a good opportunity to reflect on the body of information and guidance that is available a wide range of organisations. Whether you are trying to make sense of the variety of views on the revised International Standard, prepare for your transition or to keep up with the latest developments in Environmental Management .