Collision Deecion nd Bouncing Collisions re Hndled in Two Prs. Deecing he collision Mike Biley mj@cs.oregonse.edu. Hndling he physics of he collision collision-ouncing.ppx If You re Lucky, You Cn Deec he Collision Direcly (i.e., s closed-form soluion If You re Lucky, You Cn Compue he Collision Direcly XLEFT (x,y (vx,vy XRIGHT We need o nswer he quesion: Wh will cuse he ll o sop flying freely hrough he ir? The nswer is i will hi wll or he floor. From our rules of physics, he nex ounce will hppen one of he soluions o hese equions: XRIGHT RDIUS x v x XLEFT RDIUS x v x XRIGHT RDIUS x v x XLEFT RDIUS x v x YBOTTOM RDIUS y vy g The nex ounce will hppen one of he soluions o hese equions: XRIGHT RDIUS x v XLEFT RDIUS x v x x YBOTTOM RDIUS y vy g ( 0 g vy y YBOTTOM RDIUS vy vy g( y YBOTTOM RDIUS 3, 4 g YBOTTOM Noe: g < 0. How do you know which of he 4 vlues is he one h you should use? In he Generl Cse, here re Two Types of Collision Deecion Deecing Collisions Beween Two Ojecs. Discree B. Do s mny fs rejecions s you cn. Coninuous. Do hierrchicl fs rejecions 3. Discree: compre ll edges of Ojec gins ll fces of Ojec B B 3. Coninuous: cree pseudo-edges y connecing respecive poins in Ojec cross he ime sep, hen compre ll hese pseudo-edges of Ojec gins ll fces of Ojec B
Try o Simplify he Inersecion Tes Brek he Scene ino Grid Try o Simplify he Inersecion Tes-- Bounding Sphere Discree: You only hve o do inersecion ess gins ojecs h live in he sme grid squre. Try o Simplify he Inersecion Tes- Bounding Spheres Try o Simplify he Inersecion Tes-- Bounding Box R Ymx R C C These spheres overlp if: Disnce(C,C < R +R Xmin Xmx To void he squre roo: Disnce (C,C < (R +R Ymin Try o Simplify he Inersecion Tes- Bounding Boxes Quickly compre wo ojecs y fiing ech wih ounding ox nd hen compring he wo ounding oxes. Try o Simplify he Inersecion Tes- -- Two Types of Bounding Boxes xis-ligned Bounding Box (BB Check for overlp y looking for overlp in jus X, hen jus Y, hen jus Z These oxes do no overlp if: Xmx < Xmin Ymx < Ymin Xmx < Xmin Ymx < Ymin These oxes do overlp if: rirry-oriened Bounding Box (OBB This is igher fi round he ojec, u he overlp comprison is more involved Xmx Oregon > Xmin Se Universiy && Ymx > Ymin && Xmx > Xmin && Ymx > Ymin
Hierrchy of Bounding Boxes Discree -- You Cn Esily Tell if Poin is Inside Convex Polyhedron ssume h ll surfce normls poin ouwrds (usul convenion. Use he Disnce-from--Poin-o--Plne formul for ech fce of he polyhedron. If ll disnces re negive, he poin is inside he convex polyhedron Wh if he polyhedron is no convex? Pu Convex Hull round he polyhedron nd es gins h. If he poin is no inside he convex hull, hen i is no inside he polyhedron eiher. If i is inside he convex hull, hen more deiled nlysis is needed. P Disnce from Poin o Plne nˆ Discree nd Coninuous Compring n Edge on Ojec gins Fce on Ojec B P nˆ d Q Q P The equion of he line segmen is: P( P P 0 The equion of he plne is: x,y,z Q x,q y,q (n x,n y,n z 0 z which expnds ou o ecome he more fmilir x + By + Cz + D = 0 The disnce from he poin P o he plne is sed on he plne equion: dpq nˆ The do produc is nswering he quesion How much of (P-Q is in he norml direcion?. Noe h his gives signed disnce. If d > 0., hen P is on he sme side of he plne s he norml. P 0 If poin P wns o e poin in he plne, hen: P,P,P x y z Q x,q y,q (n,n,n x y z 0 z If we susiue he prmeric expression for P ino he plne equion, hen he only hing we don know in h equion is. Knowing * will le us compue he (x,y,z of he cul inersecion using he line equion. If * hs zero in he denominor, hen h ells us h *=, nd he line mus e prllel o he plne. This gives us he poin of inersecion wih he infinie plne. We would now use he mehod covered few slides go o see if P lies inside he ringle in quesion. n Is Poin inside Tringle? S Le: n( RQ ( SQ If Find Discree Inerference Do inry serch cross he ime sep unil you find he ime of collision P Q R If ( nn,( nn, nd( nn q r s re ll posiive, hen P is inside he ringle QRS n ( RQ ( PQ q n ( SR ( PR r n ( QS ( PS s 3
If Find Coninuous Inerference Connec ll poins cross ime nd look for he minimum in n inersecion wih he oundry The Physics of Collisions -- Definiions Line of Impc If he ojecs velociies re prllel o he Line of Impc, his is Direc Impc If he ojecs velociies re perpendiculr o he Line of Impc, his is Tngenil Impc cominion of he wo is clled n Olique Impc Direc Impc Tngenil Impc Olique Impc (oh direc nd ngenil The Physics of Collisions Fundmenl Quniies The Physics of Collisions Conservion of Momenum The momenum of n ojec is defined s is mss muliplied y is velociy: Momenum The energy of n ojec is defined s one hlf of is mss muliplied y is velociy squred: Energy In collision, he ol momenum fer he impc is equl o he ol momenum efore he impc. lwys. where he primes refer o velociies fer he impc This is referred o s he Conservion of Momenum Lw Momenum is lwys conserved hrough ny collision Conservion of Momenum s Explined y Newon s Crdle The Physics of Collisions Coefficien of Resiuion In collision, energy is conserved in he enire sysem, u no necessrily in he form of velociies. (I cn ecome permnen deformion, he, ligh, ec.. This loss of velociy is expressed s he Coefficien of Resiuion (COR. The COR, e, is how much less he relive velociies of he ojecs re fer impc hn hey were efore impc: hp://www.grnd-illusions.com/clog/newons_crdle.hml nd, of course, where would ny opic e wihou kiens? hp://dsc.discovery.com/videos/myhusers-newons-crne-crdle/ v v e( v v (he negive sign is here o indice he ounce hp://www.uzzfeed.com/koolnewslog/cs-for-he-love-of-physics-dgl 4
The Physics of Collisions Comining Momenum nd Resiuion Lws The Physics of Collisions wih Immovele Ojecs Sring wih hese wo equions: v v e( v v Tre he wo iniil velociies s inpus nd solve for he wo resuling velociies. This gives: em( vv v m m em( vv v m m To re he cse of mss eing n immovele ojec, such s he ground or solid wll, solve for he resuling velociies king he limi: lim em( vv lim v m m m em( v v lim m m m m m m m 0 v e( v v v ev Since mss is immovele, is velociy is zero, so h s pos-collision velociy is: m Collisions Experimenlly Deermining he Coefficien of Resiuion Velociies re hrd o mesure live, u disnces re no. So, drop he ojec from heigh h, nd mesure is ounce o heigh h : Before he ounce: fer he ounce: v gh 0 v gh 0 v gh v gh v e v Collisions Some Coefficiens of Resiuion of Blls Bounced on Concree Surfce Bll Meril CoR rnge golf ll 0.858 ennis ll 0.7 illird ll 0.804 hnd ll 0.75 wooden ll 0.603 seel ll ering 0.597 glss mrle 0.658 ll of ruer nds 0.88 hollow, hrd plsic ll 0.688 v gh e v gh h h hp://hyperexook.com/fcs/006/resiuion.shml The Physics of Collisions Tolly Plsic Collisions em( vv v m m em( vv v m m If e=0, hen he wo ojecs sick ogeher nd end up wih he sme resuling velociy: v v m m Very dmged B 5 mph One of my Jury Duies: Two vehicles collide. One is very dmged, he oher hrdly ll. Wh hppened? Who s righ? Hrdly dmged How much velociy chnge did ech cr undergo? (Δv is n pproxime mesure of dmge. v = 0. mph v = 5 mph =. m/sec m =.0 m =.0 e =.30 0 mph v ev.(.3 v 4.9 m/ sec m m 3 e.(.3* v.5 m/ sec m m 3 Δv = 4.9 0. = 4.9 m/sec =.0 mph Δv =.5. = 9.7 m/sec =.7 mph 5
The Physics of Collisions Tolly Elsic Collisions Wh hppens when e=? The wo fundmenl equions re Rerrnging: v v e( v v ( v v m v v m v v v v v v The Physics of Collisions Elsic Collisions Then, muliplying he wo ogeher gives: Or: m v v m v v v v v v This shows h energy is conserved when he Coefficien of Resiuion is.0 The Physics of Collisions Olique Impcs Voxelizion noher wy o do Collision Deecion? Olique Impcs re hen hndled y using vecor mh o deermine he direc nd ngenil velociy componens wih respec o he Line of Impc. The direc componens re chnged using he equions we jus derived. The ngenil componens re lef unchnged. (This ssumes no fricion. The new componens re hen comined o produce he resuling velociy vecors. Rndy Ruwendl 6