[{"data":1,"prerenderedAt":891},["ShallowReactive",2],{"navigation":3,"/api/rigid-body/collisions":72,"/api/rigid-body/collisions-surround":886},[4,22],{"title":5,"path":6,"stem":7,"children":8},"Getting Started","/getting-started","1.getting-started/1.index",[9,10,14,18],{"title":5,"path":6,"stem":7},{"title":11,"path":12,"stem":13},"Installation Guide","/getting-started/installation","1.getting-started/2.installation",{"title":15,"path":16,"stem":17},"Usage","/getting-started/usage","1.getting-started/3.usage",{"title":19,"path":20,"stem":21},"How it works","/getting-started/how-it-works","1.getting-started/how-it-works",{"title":23,"path":24,"stem":25,"children":26},"Api","/api","2.api",[27,30,64,68],{"title":28,"path":24,"stem":29},"Physics","2.api/index",{"title":31,"path":32,"stem":33,"children":34},"Rigid body","/api/rigid-body","2.api/1.rigid-body/index",[35,36,40,44,48,52,56,60],{"title":31,"path":32,"stem":33},{"title":37,"path":38,"stem":39},"Automatic colliders","/api/rigid-body/automatic-colliders","2.api/1.rigid-body/1.automatic-colliders",{"title":41,"path":42,"stem":43},"Custom colliders","/api/rigid-body/custom-colliders","2.api/1.rigid-body/2.custom-colliders",{"title":45,"path":46,"stem":47},"Forces","/api/rigid-body/forces","2.api/1.rigid-body/3.forces",{"title":49,"path":50,"stem":51},"Collisions","/api/rigid-body/collisions","2.api/1.rigid-body/4.collisions",{"title":53,"path":54,"stem":55},"Sensor","/api/rigid-body/sensor","2.api/1.rigid-body/5.sensor",{"title":57,"path":58,"stem":59},"Contact force","/api/rigid-body/contact-force","2.api/1.rigid-body/6.contact-force",{"title":61,"path":62,"stem":63},"Instance rigid body","/api/rigid-body/instance-rigid-body","2.api/1.rigid-body/7.instance-rigid-body",{"title":65,"path":66,"stem":67},"Joints","/api/joint","2.api/2.joint",{"title":69,"path":70,"stem":71},"UseRapier","/api/use-rapier","2.api/3.use-rapier",{"id":73,"title":49,"body":74,"description":879,"extension":880,"links":881,"meta":882,"navigation":883,"path":50,"seo":884,"stem":51,"__hash__":885},"docs/2.api/1.rigid-body/4.collisions.md",{"type":75,"value":76,"toc":867},"minimark",[77,83,104,212,219,224,302,308,311,411,497,501,508,511,598,604,612,698,706,763,769,774,786,789,792,842,846,863],[78,79,80],"scene-wrapper",{},[81,82],"demos-collisions",{},[84,85,86,87,91,92,95,96,99,100,103],"p",{},"To start receiving collisions events, first you need to set the\n",[88,89,90],"code",{},"active-collision"," prop to our ",[88,93,94],{},"RigidBody"," (this set all our automatic\ncolliders). Then you can start listening for events in ",[88,97,98],{},"@collision-enter"," and/or\n",[88,101,102],{},"@collision-exit",".",[105,106,111],"pre",{"className":107,"code":108,"language":109,"meta":110,"style":110},"language-html shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u003CRigidBody activeCollision @collision-enter=\"onCollisionEnter\" @collision-exit=\"onCollisionExit\">\n  \u003CTresMesh>\n    \u003CTresTorusGeometry />\n    \u003CTresMeshNormalMaterial />\n  \u003C/TresMesh>\n\u003C/RigidBody>\n\n","html","",[88,112,113,159,170,182,192,202],{"__ignoreMap":110},[114,115,118,122,125,129,132,135,138,142,144,147,149,151,154,156],"span",{"class":116,"line":117},"line",1,[114,119,121],{"class":120},"sMK4o","\u003C",[114,123,94],{"class":124},"swJcz",[114,126,128],{"class":127},"spNyl"," activeCollision",[114,130,131],{"class":127}," @collision-enter",[114,133,134],{"class":120},"=",[114,136,137],{"class":120},"\"",[114,139,141],{"class":140},"sfazB","onCollisionEnter",[114,143,137],{"class":120},[114,145,146],{"class":127}," @collision-exit",[114,148,134],{"class":120},[114,150,137],{"class":120},[114,152,153],{"class":140},"onCollisionExit",[114,155,137],{"class":120},[114,157,158],{"class":120},">\n",[114,160,162,165,168],{"class":116,"line":161},2,[114,163,164],{"class":120},"  \u003C",[114,166,167],{"class":124},"TresMesh",[114,169,158],{"class":120},[114,171,173,176,179],{"class":116,"line":172},3,[114,174,175],{"class":120},"    \u003C",[114,177,178],{"class":124},"TresTorusGeometry",[114,180,181],{"class":120}," />\n",[114,183,185,187,190],{"class":116,"line":184},4,[114,186,175],{"class":120},[114,188,189],{"class":124},"TresMeshNormalMaterial",[114,191,181],{"class":120},[114,193,195,198,200],{"class":116,"line":194},5,[114,196,197],{"class":120},"  \u003C/",[114,199,167],{"class":124},[114,201,158],{"class":120},[114,203,205,208,210],{"class":116,"line":204},6,[114,206,207],{"class":120},"\u003C/",[114,209,94],{"class":124},[114,211,158],{"class":120},[213,214,216],"h2",{"id":215},"enableccd",[88,217,218],{},"enableCcd",[84,220,221,222,103],{},"You can set continuous collision detection for fast moving object, passing as a prop ",[88,223,218],{},[105,225,227],{"className":107,"code":226,"language":109,"meta":110,"style":110},"\u003CRigidBody activeCollision enableCcd @collision-enter=\"onCollisionEnter\" @collision-exit=\"onCollisionExit\">\n  \u003CTresMesh>\n    \u003CTresTorusGeometry />\n    \u003CTresMeshNormalMaterial />\n  \u003C/TresMesh>\n\u003C/RigidBody>\n\n",[88,228,229,262,270,278,286,294],{"__ignoreMap":110},[114,230,231,233,235,237,240,242,244,246,248,250,252,254,256,258,260],{"class":116,"line":117},[114,232,121],{"class":120},[114,234,94],{"class":124},[114,236,128],{"class":127},[114,238,239],{"class":127}," enableCcd",[114,241,131],{"class":127},[114,243,134],{"class":120},[114,245,137],{"class":120},[114,247,141],{"class":140},[114,249,137],{"class":120},[114,251,146],{"class":127},[114,253,134],{"class":120},[114,255,137],{"class":120},[114,257,153],{"class":140},[114,259,137],{"class":120},[114,261,158],{"class":120},[114,263,264,266,268],{"class":116,"line":161},[114,265,164],{"class":120},[114,267,167],{"class":124},[114,269,158],{"class":120},[114,271,272,274,276],{"class":116,"line":172},[114,273,175],{"class":120},[114,275,178],{"class":124},[114,277,181],{"class":120},[114,279,280,282,284],{"class":116,"line":184},[114,281,175],{"class":120},[114,283,189],{"class":124},[114,285,181],{"class":120},[114,287,288,290,292],{"class":116,"line":194},[114,289,197],{"class":120},[114,291,167],{"class":124},[114,293,158],{"class":120},[114,295,296,298,300],{"class":116,"line":204},[114,297,207],{"class":120},[114,299,94],{"class":124},[114,301,158],{"class":120},[213,303,305],{"id":304},"activecollisiontypes",[88,306,307],{},"activeCollisionTypes",[84,309,310],{},"You can select between the following props the type of collision that fit best your needs.",[312,313,314,327],"table",{},[315,316,317],"thead",{},[318,319,320,324],"tr",{},[321,322,323],"th",{},"Type",[321,325,326],{},"Description",[328,329,330,341,351,361,371,381,391,401],"tbody",{},[318,331,332,338],{},[333,334,335],"td",{},[88,336,337],{},"ALL",[333,339,340],{},"Enable collisions between any kind of rigid-bodies (including between two non-dynamic bodies).",[318,342,343,348],{},[333,344,345],{},[88,346,347],{},"DEFAULT",[333,349,350],{},"The default active collision types, enabling collisions between a dynamic body and another body of any type, but not enabling collisions between two non-dynamic bodies.",[318,352,353,358],{},[333,354,355],{},[88,356,357],{},"DYNAMIC_DYNAMIC",[333,359,360],{},"Enable collision-detection between a collider attached to a dynamic body and another collider attached to a dynamic body.",[318,362,363,368],{},[333,364,365],{},[88,366,367],{},"DYNAMIC_FIXED",[333,369,370],{},"Enable collision-detection between a collider attached to a dynamic body and another collider attached to a fixed body (or not attached to any body).",[318,372,373,378],{},[333,374,375],{},[88,376,377],{},"DYNAMIC_KINEMATIC",[333,379,380],{},"Enable collision-detection between a collider attached to a dynamic body and another collider attached to a kinematic body.",[318,382,383,388],{},[333,384,385],{},[88,386,387],{},"FIXED_FIXED",[333,389,390],{},"Enable collision-detection between a collider attached to a fixed body (or not attached to any body) and another collider attached to a fixed body (or not attached to any body).",[318,392,393,398],{},[333,394,395],{},[88,396,397],{},"KINEMATIC_FIXED",[333,399,400],{},"Enable collision-detection between a collider attached to a kinematic body and another collider attached to a fixed body (or not attached to any body).",[318,402,403,408],{},[333,404,405],{},[88,406,407],{},"KINEMATIC_KINEMATIC",[333,409,410],{},"Enable collision-detection between a collider attached to a kinematic body and another collider attached to a kinematic body.",[105,412,414],{"className":107,"code":413,"language":109,"meta":110,"style":110},"\u003CRigidBody activeCollision activeCollisionTypes=\"ALL\" @collision-enter=\"onCollisionEnter\" @collision-exit=\"onCollisionExit\">\n  \u003CTresMesh>\n    \u003CTresTorusGeometry />\n    \u003CTresMeshNormalMaterial />\n  \u003C/TresMesh>\n\u003C/RigidBody>\n",[88,415,416,457,465,473,481,489],{"__ignoreMap":110},[114,417,418,420,422,424,427,429,431,433,435,437,439,441,443,445,447,449,451,453,455],{"class":116,"line":117},[114,419,121],{"class":120},[114,421,94],{"class":124},[114,423,128],{"class":127},[114,425,426],{"class":127}," activeCollisionTypes",[114,428,134],{"class":120},[114,430,137],{"class":120},[114,432,337],{"class":140},[114,434,137],{"class":120},[114,436,131],{"class":127},[114,438,134],{"class":120},[114,440,137],{"class":120},[114,442,141],{"class":140},[114,444,137],{"class":120},[114,446,146],{"class":127},[114,448,134],{"class":120},[114,450,137],{"class":120},[114,452,153],{"class":140},[114,454,137],{"class":120},[114,456,158],{"class":120},[114,458,459,461,463],{"class":116,"line":161},[114,460,164],{"class":120},[114,462,167],{"class":124},[114,464,158],{"class":120},[114,466,467,469,471],{"class":116,"line":172},[114,468,175],{"class":120},[114,470,178],{"class":124},[114,472,181],{"class":120},[114,474,475,477,479],{"class":116,"line":184},[114,476,175],{"class":120},[114,478,189],{"class":124},[114,480,181],{"class":120},[114,482,483,485,487],{"class":116,"line":194},[114,484,197],{"class":120},[114,486,167],{"class":124},[114,488,158],{"class":120},[114,490,491,493,495],{"class":116,"line":204},[114,492,207],{"class":120},[114,494,94],{"class":124},[114,496,158],{"class":120},[213,498,500],{"id":499},"collision-groups-and-solver-groups","Collision groups and solver groups",[502,503,505],"h3",{"id":504},"collisiongroups",[88,506,507],{},"collisionGroups",[84,509,510],{},"For more complex scenes you can select how collider interact with each other using collisionsGroups",[105,512,514],{"className":107,"code":513,"language":109,"meta":110,"style":110},"\u003CRigidBody activeCollision :collisionGroups=\"0x000D0004\" @collision-enter=\"onCollisionEnter\" @collision-exit=\"onCollisionExit\">\n  \u003CTresMesh>\n    \u003CTresTorusGeometry />\n    \u003CTresMeshNormalMaterial />\n  \u003C/TresMesh>\n\u003C/RigidBody>\n",[88,515,516,558,566,574,582,590],{"__ignoreMap":110},[114,517,518,520,522,524,527,529,531,534,536,538,540,542,544,546,548,550,552,554,556],{"class":116,"line":117},[114,519,121],{"class":120},[114,521,94],{"class":124},[114,523,128],{"class":127},[114,525,526],{"class":127}," :collisionGroups",[114,528,134],{"class":120},[114,530,137],{"class":120},[114,532,533],{"class":140},"0x000D0004",[114,535,137],{"class":120},[114,537,131],{"class":127},[114,539,134],{"class":120},[114,541,137],{"class":120},[114,543,141],{"class":140},[114,545,137],{"class":120},[114,547,146],{"class":127},[114,549,134],{"class":120},[114,551,137],{"class":120},[114,553,153],{"class":140},[114,555,137],{"class":120},[114,557,158],{"class":120},[114,559,560,562,564],{"class":116,"line":161},[114,561,164],{"class":120},[114,563,167],{"class":124},[114,565,158],{"class":120},[114,567,568,570,572],{"class":116,"line":172},[114,569,175],{"class":120},[114,571,178],{"class":124},[114,573,181],{"class":120},[114,575,576,578,580],{"class":116,"line":184},[114,577,175],{"class":120},[114,579,189],{"class":124},[114,581,181],{"class":120},[114,583,584,586,588],{"class":116,"line":194},[114,585,197],{"class":120},[114,587,167],{"class":124},[114,589,158],{"class":120},[114,591,592,594,596],{"class":116,"line":204},[114,593,207],{"class":120},[114,595,94],{"class":124},[114,597,158],{"class":120},[502,599,601],{"id":600},"solvergroups",[88,602,603],{},"solverGroups",[84,605,606,608,609,611],{},[88,607,603],{}," works with the same bitmask format as ",[88,610,507],{},", but controls a different step in the physics pipeline:",[105,613,615],{"className":107,"code":614,"language":109,"meta":110,"style":110},"\u003CRigidBody activeCollision :solverGroups=\"0x000D0004\" @collision-enter=\"onCollisionEnter\" @collision-exit=\"onCollisionExit\">\n  \u003CTresMesh>\n    \u003CTresTorusGeometry />\n    \u003CTresMeshNormalMaterial />\n  \u003C/TresMesh>\n\u003C/RigidBody>\n",[88,616,617,658,666,674,682,690],{"__ignoreMap":110},[114,618,619,621,623,625,628,630,632,634,636,638,640,642,644,646,648,650,652,654,656],{"class":116,"line":117},[114,620,121],{"class":120},[114,622,94],{"class":124},[114,624,128],{"class":127},[114,626,627],{"class":127}," :solverGroups",[114,629,134],{"class":120},[114,631,137],{"class":120},[114,633,533],{"class":140},[114,635,137],{"class":120},[114,637,131],{"class":127},[114,639,134],{"class":120},[114,641,137],{"class":120},[114,643,141],{"class":140},[114,645,137],{"class":120},[114,647,146],{"class":127},[114,649,134],{"class":120},[114,651,137],{"class":120},[114,653,153],{"class":140},[114,655,137],{"class":120},[114,657,158],{"class":120},[114,659,660,662,664],{"class":116,"line":161},[114,661,164],{"class":120},[114,663,167],{"class":124},[114,665,158],{"class":120},[114,667,668,670,672],{"class":116,"line":172},[114,669,175],{"class":120},[114,671,178],{"class":124},[114,673,181],{"class":120},[114,675,676,678,680],{"class":116,"line":184},[114,677,175],{"class":120},[114,679,189],{"class":124},[114,681,181],{"class":120},[114,683,684,686,688],{"class":116,"line":194},[114,685,197],{"class":120},[114,687,167],{"class":124},[114,689,158],{"class":120},[114,691,692,694,696],{"class":116,"line":204},[114,693,207],{"class":120},[114,695,94],{"class":124},[114,697,158],{"class":120},[502,699,701,703,704],{"id":700},"collisiongroups-vs-solvergroups",[88,702,507],{}," vs ",[88,705,603],{},[312,707,708,724],{},[315,709,710],{},[318,711,712,715,718,721],{},[321,713,714],{},"Prop",[321,716,717],{},"What it filters",[321,719,720],{},"Contact events?",[321,722,723],{},"Contact forces?",[328,725,726,745],{},[318,727,728,732,740,743],{},[333,729,730],{},[88,731,507],{},[333,733,734,735,739],{},"Whether contacts are ",[736,737,738],"strong",{},"detected"," at all (narrow-phase)",[333,741,742],{},"✗ skipped",[333,744,742],{},[318,746,747,751,758,761],{},[333,748,749],{},[88,750,603],{},[333,752,753,754,757],{},"Whether contact ",[736,755,756],{},"forces"," are applied (after narrow-phase)",[333,759,760],{},"✓ still fired",[333,762,742],{},[84,764,765,766,768],{},"Use ",[88,767,507],{}," when you want two colliders to completely ignore each other — it's more efficient because it skips both contact detection and force computation.",[84,770,765,771,773],{},[88,772,603],{}," when you still want collision events to fire (e.g. to detect a hit) but don't want physics forces applied — for example, to implement your own custom force response.",[775,776,777],"prose-note",{},[84,778,779,780],{},"For a complete explanation check ",[781,782,500],"a",{"href":783,"rel":784},"https://rapier.rs/docs/user_guides/javascript/colliders#collision-groups-and-solver-groups",[785],"nofollow",[213,787,41],{"id":788},"custom-colliders",[84,790,791],{},"If you want to detect collisions on custom colliders is the same methodology but applied to the custom collider, for example",[105,793,795],{"className":107,"code":794,"language":109,"meta":110,"style":110},"\u003CBallCollider\n  :args=\"[1, 1, 1]\"\n  activeCollision\n  @collision-enter=\"onCollisionEnter\"\n/>\n",[88,796,797,804,819,824,837],{"__ignoreMap":110},[114,798,799,801],{"class":116,"line":117},[114,800,121],{"class":120},[114,802,803],{"class":124},"BallCollider\n",[114,805,806,809,811,813,816],{"class":116,"line":161},[114,807,808],{"class":127},"  :args",[114,810,134],{"class":120},[114,812,137],{"class":120},[114,814,815],{"class":140},"[1, 1, 1]",[114,817,818],{"class":120},"\"\n",[114,820,821],{"class":116,"line":172},[114,822,823],{"class":127},"  activeCollision\n",[114,825,826,829,831,833,835],{"class":116,"line":184},[114,827,828],{"class":127},"  @collision-enter",[114,830,134],{"class":120},[114,832,137],{"class":120},[114,834,141],{"class":140},[114,836,818],{"class":120},[114,838,839],{"class":116,"line":194},[114,840,841],{"class":120},"/>\n",[213,843,845],{"id":844},"events","Events",[847,848,849,857],"field-group",{},[850,851,854],"field",{"name":852,"type":853},"collision-enter","(payload: { source: SourceTarget, target: SourceTarget }) => void",[84,855,856],{},"Triggered when a collider starts colliding with another collider.",[850,858,860],{"name":859,"type":853},"collision-exit",[84,861,862],{},"Triggered when a collider stops colliding with another collider.",[864,865,866],"style",{},"html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":110,"searchDepth":117,"depth":161,"links":868},[869,870,871,877,878],{"id":215,"depth":161,"text":218},{"id":304,"depth":161,"text":307},{"id":499,"depth":161,"text":500,"children":872},[873,874,875],{"id":504,"depth":172,"text":507},{"id":600,"depth":172,"text":603},{"id":700,"depth":172,"text":876},"collisionGroups vs solverGroups",{"id":788,"depth":161,"text":41},{"id":844,"depth":161,"text":845},"Detect and respond to collision events between rigid bodies using the activeCollision prop and collision-enter / collision-exit event listeners.","md",null,{},true,{"title":49,"description":879},"gQJxxkk3FxvGleNgdt8UEniJc5PcAtZSOFnEc4Uv7tU",[887,889],{"title":45,"path":46,"stem":47,"description":888,"children":-1},"Apply forces and impulses to rigid bodies to drive physics interactions, such as making objects jump or move programmatically.",{"title":53,"path":54,"stem":55,"description":890,"children":-1},"Use sensor colliders to detect when objects enter or exit a region without generating physical contact responses.",1781680040530]