2D Collision Detection For CSE 3902 By: Matt Boggus.

Slides:



Advertisements
Similar presentations
Programming with App Inventor Computing Institute for K-12 Teachers Summer 2012 Workshop.
Advertisements

IN THE SUPERVISIONS OF: DR\KAMEL ALI ARRAM ENG\LAMIAA Computer Vision Course.
2.3. B OUNDING V OLUMES Bounding volumes of use for collision detection.
Korea Univ. Graphics Lab. 3D Game Engine Design Chapter 12. Spatial Sorting Chung Ji Hye
Space Partitioning for Broad Sweep Collision Detection Part 2 - Quadtrees Game Design Experience Professor Jim Whitehead February 13, 2009 Creative Commons.
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Basic 3D collision detection We want to know if objects have touched Objects are considered to.
Collision Detection CSE 191A: Seminar on Video Game Programming Lecture 3: Collision Detection UCSD, Spring, 2003 Instructor: Steve Rotenberg.
Binary Image Compression Using Efficient Partitioning into Rectangular Regions IEEE Transactions on Communications Sherif A.Mohamed and Moustafa M. Fahmy.
Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers.
Week 10 Recap CSE 115 Spring For-each loop When we have a collection and want to do something to all elements of that collection we use the for-each.
Oct 26, Fall 2006IAT 4101 Collision Detection. Oct 26, Fall 2006IAT 4102 Collision Detection  Essential for many games –Shooting –Kicking, punching,
CS 326 A: Motion Planning robotics.stanford.edu/~latombe/cs326/2004/index.htm Collision Detection and Distance Computation.
CSE 326 Hashing Richard Anderson (instead of Martin Tompa)
Oct 3, Fall 2005Game Design1 Collision Detection.
Stacks CS-240 & CS-341 Dick Steflik. Stacks Last In, First Out operation - LIFO As items are added they are chronologically ordered, items are removed.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
2D Physics and Camera Systems For CSE 3902 By: Matt Boggus.
Surface Area Return to table of contents.
Data Structures - Queues
CSE 381 – Advanced Game Programming Quickhull and GJK.
Collision handling: detection and response
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 23 Game Graphics II.
(C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
Image Representation. Objectives  Bitmaps: resolution, colour depth and simple bitmap file calculations.  Vector graphics: drawing list – objects and.
By: James Ross. Outline  Collision Conecpts  Axis Aligned Bounding Box  ECMs  Objective  Methodology  Expected Results.
Scratch Programming Lesson 2 First glance to programming logic.
CSE 113 Introduction to Computer Programming Lecture slides for Week 12 Monday, November 14 th, 2011 Instructor: Scott Settembre.
11 Adding Tomato Targets Session Session Overview  We now have a game which lets a player bounce a piece of cheese on a bread bat  Now we have.
11 Making a Sprite Session 4.2. Session Overview  Describe the principle of a game sprite, and see how to create a sprite in an XNA game  Learn more.
Hidden Surface Removal
Roy McElmurry. More:
Additional Design Patterns for Games For CSE 3902 Matt Boggus.
Collision Detection and Response. Motivation OpenGL is a rendering system OpenGL is a rendering system OpenGL has no underlying knowledge of the objects.
The Last Warrior Team 2 - G amers & C oders Shachi Chandrashekhar, Matt Frey, Satoshi Inoue, Chinmay Kulkarni, Darshan Shinde, Peng Ye.
XNA Basic Displaying Image & Collision Detect. What’s format image that XNA support? XNA support only.bmp.png and.jpg image..PNG have transparent region.
Collision Detection Kaboo m!. The Plan ● What is collision detection? ● Why is collision detection important? ● Classification of collision detection.
Collision Detection And Response Jae Chun KyungSoo Im Chau Vo Hoang Vu.
Computer Game Design and Development Collision Detection Havok Destruction.
By: Aaron Knight. What is Emulation? Emulation is the process of implementing in software a set of hardware. Applications meant for another platform can.
2D drawing basics For CSE 3902 By: Matt Boggus. Overview 2D coordinate systems Raster images Sprite drawing in XNA.
1 compares each element of the array with the search key. works well for small arrays or for unsorted arrays works for any table slow can put more commonly.
Find the Surface Area of the Cube. 6 Square Faces x 6 = 73.5 cm 2 Surface Area = 73.5 cm 2.
13. Sprites. Outline 1.Game Things in Pygame (again) 2.The Pygame sprite Module 3.The Sprite Class 4.Groups of Sprites 5.Types of Collision Detection.
2D Collision Detection For CSE 3902 By: Matt Boggus.
2D Physics and Camera Systems
Additional Design Patterns for Games
Introduction to Collision Detection
2D drawing basics For CSE 3902 By: Matt Boggus.
Background Shapes & Collision Resolution (Top-down and Side-scrolling)
Intro & Point-to-Box, Circle-to-Circle, Point-to-Circle
Collision Detection Box-to-Box.
Graphics Fundamentals
CS148: Introduction to Computer Graphics and Imaging
Learning Intention I will learn how a computer stores graphics.
Computer Graphics.
13. Sprites Let's Learn Python and Pygame
Flooding © 2018.
Objective of the lesson
Polymorphism CT1513.
Let’s Learn 7. Sprites Saengthong School, June – August 2016
Collision Detection Platforms.
Rendering – Basic Concepts
Collision Detection.
Physics Engine for Soft Bodies
The coordinate system Susan Ibach | Technical Evangelist
The Image The pixels in the image The mask The resulting image 255 X
Shadows CSE 681.
Chapter 7 The Game Loop and Animation
CoE Software Lab II , Semester 2, Sprites.
Presentation transcript:

2D Collision Detection For CSE 3902 By: Matt Boggus

Outline Collision tests Collision detection loops Pixel-pixel Square-square Axis-aligned bounding box (rectangle) testing Collision detection loops Exhaustive comparison Static objects vs. dynamic objects

Collision Detection tests

Pixel-pixel test Given sprite pixel data and position on screen, make a binary mask for each sprite Detection test (XOR == 1) Not intersecting (XOR == 0) AND (OR == 1) Intersecting Pro: Accurate Con: Slow; requires working with image data Raster graphic sprites (left) and masks (right)

Square-square test

Square-square test

Square-square top-bottom collision

Square-square left-right collision

Non-square collision example (values indicate top-bottom)

Axis-aligned bounding box testing

Axis-aligned bounding box testing

XNA rectangle and methods Given two rectangles rectangleA and rectangleB Rectangle.Intersects(Rectangle) Returns true if the rectangles are intersecting, otherwise false Example call: rectangleA.Intersects(rectangleB); Rectangle.Intersect Method (Rectangle, Rectangle) Returns the area where the two rectangles overlap, an empty rectangle if there is no overlap Example call: Rectangle.Intersect(rectangleA,rectangleB);

Rectangle Intersect left-right

Rectangle Intersect top-bottom

Types of Collision loops

Exhaustive comparison Given mario, enemyList (length n), and blockList (length m), test mario vs. enemyList[0] through [n-1] mario vs. blockList[0] through [m-1] enemyList[0] vs. enemyList[1] through [n-1] enemyList[1] vs. enemyList[2] through [n-1] … blockList[0] vs. blockList[1] through [m-1] ?

Static vs. Dynamic Non-moving, or static, objects only need to be compared against dynamics, not other static objects foreach static object, test against all dynamic objects foreach dynamic object, test against all other dynamic objects, taking care not to duplicate tests