1 / 16

Simulation and Animation

Simulation and Animation. Collision Detection – Narrow Phase. Collision Detection. Contact . Where do bodies hit each other ? Bodies described by polyhedra Rigid bodies 2 cases : Vertex/Face example : cube on table , 4 Vertex/Face contacts for 4 cube vertices

ros
Télécharger la présentation

Simulation and Animation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Simulation and Animation Collision Detection – Narrow Phase

  2. Collision Detection

  3. Contact • Where do bodieshiteachother? • Bodiesdescribedbypolyhedra • Rigid bodies • 2 cases: • Vertex/Faceexample: cube on table, 4 Vertex/Face contactsfor 4 cubevertices • Edge/Edge:example: cubeprotrudesovertable, 2 Vertex/Face contactsand 2 Edge/Edge contactswithdeskedge

  4. Contact • Describingthecontact: • Involvedbodies • Contactpoint in worldcoordinates • Collision normal • Face normal in caseof Vertex/Face contact • Cross productbetweenedgevectors in caseof Edge/Edge contact

  5. Contact • Discretizationproblem • Contactdetectionatsimulation time step • Collisionhastoconsidertime constraints 4D problem Contactoccurs, but mightbemissed due to fix time discretizationofsimulation t t + 1

  6. Contact • Basic algorithmsforcollisiondetection • Detectingcollisionoccurence • Detectingpointofcontact • Modelling a response • Most common in games: • Broad/Narrowphasealgorithms • Broadphase: rejectobjectsthatcannotcollide • Bsp-Trees, Boundingvolumehiearchies, separatingaxes • Narrowphase: Applyaccuratecollisiondetection • Polyhedron/Polyhedron, closestfeatures

  7. Contact • Narrowphasecollisiondetection • (Convex) polyhedron/polyhedrontest • Anyvertexofeitherobjectiscontained in theotherone v: vertex, u: vertex on face, n: outwardfacing normal • Penetration betweenedgesandfaces • Ifshortestdistancebetweenedgepointschangessign • Computeintersectionpointsbetweenedgesand infinite planes • Sortintervalsandtesttheirpointsasabove • Check forexactlyalignedobjects

  8. Narrow Phase between triangles Step 1: Compute plane equations

  9. Narrow Phase between triangles Step 2: Computevertex-to-plane distances andlookforsignchange also computeviceversadistances

  10. Narrow Phase between triangles • Narrowphasecollisiondetectionbetweentriangles • Test foroverlappingintervalsalong plane-plane intersection L L L=O+tD D=N1×N2

  11. Narrow Phase between triangles V0,1 V2,1 pv,1,1=D∙(V1,1-O) d0,1 L t2 t1 K0,1 K1,1 π1 d1,1 pv,0,1=D∙(V0,1-O) V1,1 π2

  12. Optimizations • Interval shift does not influence overlap  avoid computation of O and replace by • Projection of L onto an arbitrary axis does not influence overlap

  13. Contact • Narrowphasecollisiondetectionbetweentriangles • Based on axial projections • Triangleshavenormals N, M andedges Ei, Fj • Compute plane equation p0,p1 oftriangle0,1 • Ifbothtrianglesare parallel - reject • Ifbothtrianglesarecoplanar – 2D (overlap/in-out)-test • Computedistancesofverticesof1,0 to p0,p1 • If all distanceshave same sign - reject • General case: intersectionis a line L (o+td, d=NxM) • Computeprojectionsofverticesonto L: (d·(v-o)) • Computeprojectionsofverticesonto p0,p1 • Computeintervalsfromsimilarityobservation

  14. Contact • Space-Time constraints • Consider time discretization, e.g. bounding spheres • Size of smallest sphere determined by time step of simulation and maximal velocity • Spheres are taken from smaller object • Collisions between dynamic and static objects • Consider velocity of moving objects • Predict first collision within given time interval • Only if collision occurs, tree model has to be processed recursively

  15. Contact • Dynamicallymovingsphereand plane • Sphereofradius r andcenter C(t) = C(0) + t V • Plane equation: NX=d • Check forcollision in time interval t  [0,tmax] • Distance(center, plane): |NC(t)-d| • First time ofcontact: |NC(T)-d| = r • T<0: spheremovesaway • T>0: sphere will intersectatposition C(T)

  16. Contact • Dynamicallymoving box and plane • Project box half-sizesonto normal lineof plane • Take projectedvalueasradiusof a sphere • Applysphere-plane testfromabove • Findingintersectionpointismorecomplex • Depends on box orientation - face, lineorvertex

More Related