[{"data":1,"prerenderedAt":921},["ShallowReactive",2],{"navigation":3,"/api/rigid-body":72,"/api/rigid-body-surround":916},[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":31,"body":74,"description":909,"extension":910,"links":911,"meta":912,"navigation":913,"path":32,"seo":914,"stem":33,"__hash__":915},"docs/2.api/1.rigid-body/index.md",{"type":75,"value":76,"toc":900},"minimark",[77,93,110,116,121,136,269,273,283,286,461,466,525,536,540,759,778,782,840,844,896],[78,79,80,84,85,88,89,92],"p",{},[81,82,83],"code",{},"@tresjs/rapier"," provides a ",[81,86,87],{},"RigidBody"," component compatible with the ",[81,90,91],{},"Tresjs","\necosystem, with the advantage of making the \"bound\" between the two worlds\n(physic world and our 3D scene).",[94,95,96],"prose-note",{},[78,97,98,99,102,103],{},"The information on this page is a summary of the ",[100,101,87],"strong",{}," instance, please check the ",[104,105,109],"a",{"href":106,"rel":107},"https://rapier.rs/docs/user_guides/javascript/rigid_bodies",[108],"nofollow","original Rapier documentation",[111,112,113],"scene-wrapper",{},[114,115],"demos-rigid-body",{},[117,118,120],"h2",{"id":119},"basic-usage","Basic usage",[78,122,123,124,126,127,129,130,135],{},"To use a ",[81,125,87],{}," component, import it from\n",[81,128,83],{}," and then pass the element you want to attach via\n",[104,131,134],{"href":132,"rel":133},"https://vuejs.org/guide/components/slots.html#scoped-slots",[108],"slot",".",[137,138,143],"pre",{"className":139,"code":140,"language":141,"meta":142,"style":142},"language-vue shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u003Ctemplate>\n  \u003CRigidBody>\n    \u003CTresMesh :position=\"[0, 8, 0]\">\n      \u003CTresTorusGeometry />\n      \u003CTresMeshNormalMaterial />\n    \u003C/TresMesh>\n  \u003C/RigidBody>\n\u003C/template>\n","vue","",[81,144,145,161,171,217,229,239,249,259],{"__ignoreMap":142},[146,147,150,154,158],"span",{"class":148,"line":149},"line",1,[146,151,153],{"class":152},"sMK4o","\u003C",[146,155,157],{"class":156},"swJcz","template",[146,159,160],{"class":152},">\n",[146,162,164,167,169],{"class":148,"line":163},2,[146,165,166],{"class":152},"  \u003C",[146,168,87],{"class":156},[146,170,160],{"class":152},[146,172,174,177,180,183,187,190,193,196,200,203,206,208,210,213,215],{"class":148,"line":173},3,[146,175,176],{"class":152},"    \u003C",[146,178,179],{"class":156},"TresMesh",[146,181,182],{"class":152}," :",[146,184,186],{"class":185},"spNyl","position",[146,188,189],{"class":152},"=",[146,191,192],{"class":152},"\"",[146,194,195],{"class":152},"[",[146,197,199],{"class":198},"sbssI","0",[146,201,202],{"class":152},", ",[146,204,205],{"class":198},"8",[146,207,202],{"class":152},[146,209,199],{"class":198},[146,211,212],{"class":152},"]",[146,214,192],{"class":152},[146,216,160],{"class":152},[146,218,220,223,226],{"class":148,"line":219},4,[146,221,222],{"class":152},"      \u003C",[146,224,225],{"class":156},"TresTorusGeometry",[146,227,228],{"class":152}," />\n",[146,230,232,234,237],{"class":148,"line":231},5,[146,233,222],{"class":152},[146,235,236],{"class":156},"TresMeshNormalMaterial",[146,238,228],{"class":152},[146,240,242,245,247],{"class":148,"line":241},6,[146,243,244],{"class":152},"    \u003C/",[146,246,179],{"class":156},[146,248,160],{"class":152},[146,250,252,255,257],{"class":148,"line":251},7,[146,253,254],{"class":152},"  \u003C/",[146,256,87],{"class":156},[146,258,160],{"class":152},[146,260,262,265,267],{"class":148,"line":261},8,[146,263,264],{"class":152},"\u003C/",[146,266,157],{"class":156},[146,268,160],{"class":152},[117,270,272],{"id":271},"types","Types",[78,274,275,276,278,279,282],{},"We can specify which kind of ",[81,277,87],{}," type we want. By default is set to ",[81,280,281],{},"Dynamic","(see below).",[78,284,285],{},"A basic floor example with type fixed:",[137,287,289],{"className":139,"code":288,"language":141,"meta":142,"style":142},"\u003Ctemplate>\n  \u003CRigidBody type=\"fixed\">\n    \u003CTresMesh :position=\"[0, 0, 0]\">\n      \u003CTresPlaneGeometry :args=\"[20, 20, 20]\" :rotate-x=\"-Math.PI / 2\" />\n      \u003CTresMeshBasicMaterial color=\"#f4f4f4\" />\n    \u003C/TresMesh>\n  \u003C/RigidBody>\n\u003C/template>\n",[81,290,291,299,320,352,416,437,445,453],{"__ignoreMap":142},[146,292,293,295,297],{"class":148,"line":149},[146,294,153],{"class":152},[146,296,157],{"class":156},[146,298,160],{"class":152},[146,300,301,303,305,308,310,312,316,318],{"class":148,"line":163},[146,302,166],{"class":152},[146,304,87],{"class":156},[146,306,307],{"class":185}," type",[146,309,189],{"class":152},[146,311,192],{"class":152},[146,313,315],{"class":314},"sfazB","fixed",[146,317,192],{"class":152},[146,319,160],{"class":152},[146,321,322,324,326,328,330,332,334,336,338,340,342,344,346,348,350],{"class":148,"line":173},[146,323,176],{"class":152},[146,325,179],{"class":156},[146,327,182],{"class":152},[146,329,186],{"class":185},[146,331,189],{"class":152},[146,333,192],{"class":152},[146,335,195],{"class":152},[146,337,199],{"class":198},[146,339,202],{"class":152},[146,341,199],{"class":198},[146,343,202],{"class":152},[146,345,199],{"class":198},[146,347,212],{"class":152},[146,349,192],{"class":152},[146,351,160],{"class":152},[146,353,354,356,359,361,364,366,368,370,373,375,377,379,381,383,385,387,390,392,394,397,401,403,406,409,412,414],{"class":148,"line":219},[146,355,222],{"class":152},[146,357,358],{"class":156},"TresPlaneGeometry",[146,360,182],{"class":152},[146,362,363],{"class":185},"args",[146,365,189],{"class":152},[146,367,192],{"class":152},[146,369,195],{"class":152},[146,371,372],{"class":198},"20",[146,374,202],{"class":152},[146,376,372],{"class":198},[146,378,202],{"class":152},[146,380,372],{"class":198},[146,382,212],{"class":152},[146,384,192],{"class":152},[146,386,182],{"class":152},[146,388,389],{"class":185},"rotate-x",[146,391,189],{"class":152},[146,393,192],{"class":152},[146,395,396],{"class":152},"-",[146,398,400],{"class":399},"sTEyZ","Math",[146,402,135],{"class":152},[146,404,405],{"class":399},"PI",[146,407,408],{"class":152}," / ",[146,410,411],{"class":198},"2",[146,413,192],{"class":152},[146,415,228],{"class":152},[146,417,418,420,423,426,428,430,433,435],{"class":148,"line":231},[146,419,222],{"class":152},[146,421,422],{"class":156},"TresMeshBasicMaterial",[146,424,425],{"class":185}," color",[146,427,189],{"class":152},[146,429,192],{"class":152},[146,431,432],{"class":314},"#f4f4f4",[146,434,192],{"class":152},[146,436,228],{"class":152},[146,438,439,441,443],{"class":148,"line":241},[146,440,244],{"class":152},[146,442,179],{"class":156},[146,444,160],{"class":152},[146,446,447,449,451],{"class":148,"line":251},[146,448,254],{"class":152},[146,450,87],{"class":156},[146,452,160],{"class":152},[146,454,455,457,459],{"class":148,"line":261},[146,456,264],{"class":152},[146,458,157],{"class":156},[146,460,160],{"class":152},[462,463,465],"h3",{"id":464},"available-types","Available types",[467,468,469,482],"table",{},[470,471,472],"thead",{},[473,474,475,479],"tr",{},[476,477,271],"th",{"align":478},"left",[476,480,481],{"align":478},"Description",[483,484,485,495,505,515],"tbody",{},[473,486,487,492],{},[488,489,490],"td",{"align":478},[81,491,281],{},[488,493,494],{"align":478},"Indicates that the body is affected by external forces and contacts.",[473,496,497,502],{},[488,498,499],{"align":478},[81,500,501],{},"Fixed",[488,503,504],{"align":478},"Indicates the body cannot move. It acts as if it has an infinite mass and will not be affected by any force.",[473,506,507,512],{},[488,508,509],{"align":478},[81,510,511],{},"KinematicPositionBased",[488,513,514],{"align":478},"Indicates that the body position must not be altered by the physics engine.",[473,516,517,522],{},[488,518,519],{"align":478},[81,520,521],{},"KinematicVelocityBased",[488,523,524],{"align":478},"Indicates that the body velocity must not be altered by the physics engine.",[526,527,528],"info",{},[78,529,530,531],{},"Both position-based and velocity-based kinematic bodies are mostly the\nsame. Choosing between both is mostly a matter of preference between\nposition-based control and velocity-based control.\nMore info at ",[104,532,535],{"href":533,"rel":534},"https://rapier.rs/docs/user_guides/javascript/rigid_bodies#rigid-body-type",[108],"Rigid-body type",[117,537,539],{"id":538},"props","Props",[541,542,543,559,569,581,591,599,607,615,625,633,643,651,661,669,677,686,694,702,710,718,728,738,744],"field-group",{},[544,545,548],"field",{"name":546,"type":547},"type","RigidBodyType",[78,549,550,551,554,555,558],{},"Default: ",[81,552,553],{},"dynamic"," - ",[81,556,557],{},"rigidBody"," type.",[544,560,563],{"name":561,"type":562},"collider","ColliderShape | false",[78,564,550,565,568],{},[81,566,567],{},"cuboid"," - automatic collider.",[544,570,573],{"name":571,"type":572},"gravityScale","number",[78,574,550,575,578,579,135],{},[81,576,577],{},"1"," - gravity for the ",[81,580,557],{},[544,582,584],{"name":583,"type":572},"additionalMass",[78,585,550,586,588,589,135],{},[81,587,199],{}," - add extra mass to the ",[81,590,557],{},[544,592,594],{"name":593,"type":572},"linearDamping",[78,595,550,596,598],{},[81,597,199],{}," - set the linear damping.",[544,600,602],{"name":601,"type":572},"angularDamping",[78,603,550,604,606],{},[81,605,199],{}," - set the angular damping.",[544,608,610],{"name":609,"type":572},"dominanceGroup",[78,611,550,612,614],{},[81,613,199],{}," - set the dominance group.",[544,616,619],{"name":617,"type":618},"linvel","TresVector3 | THREE.Vector3",[78,620,550,621,624],{},[81,622,623],{},"x: 0, y: 0, z: 0"," - linear velocity.",[544,626,628],{"name":627,"type":618},"angvel",[78,629,550,630,632],{},[81,631,623],{}," - angular velocity.",[544,634,637],{"name":635,"type":636},"enabledRotations","[x: boolean, y: boolean, z: boolean]",[78,638,550,639,642],{},[81,640,641],{},"{x: true, y: true, z: true }"," - enable rotations in specific axis.",[544,644,646],{"name":645,"type":636},"enabledTranslations",[78,647,550,648,650],{},[81,649,641],{}," - enable translations in specific axis.",[544,652,655],{"name":653,"type":654},"lockTranslations","boolean",[78,656,550,657,660],{},[81,658,659],{},"false"," - Lock all translations.",[544,662,664],{"name":663,"type":654},"lockRotations",[78,665,550,666,668],{},[81,667,659],{}," - Lock all rotations.",[544,670,672],{"name":671,"type":654},"enableCcd",[78,673,550,674,676],{},[81,675,659],{}," - Enable continuous collision detection.",[544,678,680],{"name":679,"type":572},"friction",[78,681,550,682,685],{},[81,683,684],{},"0.5"," - The friction coefficient of this collider. (automatic-collider).",[544,687,689],{"name":688,"type":572},"mass",[78,690,550,691,693],{},[81,692,577],{}," - Mass of the collider. (automatic-collider).",[544,695,697],{"name":696,"type":572},"density",[78,698,550,699,701],{},[81,700,199],{}," - Restitution controls how elastic (aka. bouncy) a contact is. (automatic-collider).",[544,703,705],{"name":704,"type":572},"restitution",[78,706,550,707,709],{},[81,708,577],{}," - The collider density. If non-zero the collider's mass and angular inertia will be added. (automatic-collider).",[544,711,713],{"name":712,"type":654},"activeCollision",[78,714,550,715,717],{},[81,716,659],{}," - To set the collider receiver/emitter collision events (automatic-collider).",[544,719,722],{"name":720,"type":721},"activeCollisionTypes","ActiveCollisionTypes",[78,723,550,724,727],{},[81,725,726],{},"ActiveCollisionTypes.DEFAULT"," - Type of the collision event. (automatic-collider).",[544,729,732],{"name":730,"type":731},"collisionGroups","number | undefined",[78,733,550,734,737],{},[81,735,736],{},"undefined"," - To specify collision groups. (automatic-collider).",[544,739,740],{"name":712,"type":654},[78,741,550,742,717],{},[81,743,659],{},[544,745,747],{"name":746,"type":654},"activeContactForce",[78,748,550,749,751,752,755,756,135],{},[81,750,659],{}," - Enables contact-force events. Required to use the ",[81,753,754],{},"@contact-force"," event. See ",[104,757,758],{"href":58},"Contact Force",[94,760,761],{},[78,762,763,764,766,767,772,773,135],{},"The ",[81,765,557],{}," instance has many other functions, please check the\n",[104,768,771],{"href":769,"rel":770},"https://rapier.rs/docs/api/javascript/JavaScript3D/",[108],"official docs"," for a\ncomplete list, if you need them, you can\nuse",[104,774,777],{"href":775,"rel":776},"https://vuejs.org/guide/essentials/template-refs.html#template-refs",[108],"Template ref",[117,779,781],{"id":780},"events","Events",[541,783,784,796,806,821,833],{},[544,785,788],{"name":786,"type":787},"collision-enter","(payload: { source: SourceTarget, target: SourceTarget }) => void",[78,789,790,791,793,794,135],{},"Triggered when a collider starts colliding with another collider. Requires ",[81,792,712],{}," prop to be set. See ",[104,795,49],{"href":50},[544,797,799],{"name":798,"type":787},"collision-exit",[78,800,801,802,793,804,135],{},"Triggered when a collider stops colliding with another collider. Requires ",[81,803,712],{},[104,805,49],{"href":50},[544,807,809],{"name":808,"type":787},"intersection-enter",[78,810,811,812,814,815,818,819,135],{},"Triggered when a sensor collider starts intersecting another collider. Requires ",[81,813,712],{}," and ",[81,816,817],{},"sensor"," props. See ",[104,820,53],{"href":54},[544,822,824],{"name":823,"type":787},"intersection-exit",[78,825,826,827,814,829,818,831,135],{},"Triggered when a sensor collider stops intersecting another collider. Requires ",[81,828,712],{},[81,830,817],{},[104,832,53],{"href":54},[544,834,837],{"name":835,"type":836},"contact-force","(payload: ContactForcePayload) => void",[78,838,839],{},"Triggered every simulation step while two colliders are in contact and the force exceeds the threshold.",[117,841,843],{"id":842},"expose-object","Expose object",[541,845,846,859,870,881],{},[544,847,849],{"name":848,"type":87},"instance",[78,850,763,851,853,854],{},[81,852,87],{}," instance created by Rapier. ",[104,855,858],{"href":856,"rel":857},"https://rapier.rs/javascript3d/classes/RigidBody.html",[108],"See API",[544,860,863],{"name":861,"type":862},"rigidBodyDesc","RigidBodyDesc",[78,864,865,866],{},"The Rapier rigid-body descriptor used to initialize the body. ",[104,867,858],{"href":868,"rel":869},"https://rapier.rs/javascript3d/classes/RigidBodyDesc.html",[108],[544,871,874],{"name":872,"type":873},"context","RigidBodyContext",[78,875,876,877,880],{},"Collider context information (",[81,878,879],{},"colliderInfos",") associated with this rigid body.",[544,882,885],{"name":883,"type":884},"group","TresObject3D",[78,886,887,888,891,892],{},"Parent Three.js object/group (",[81,889,890],{},"parentObject",") that contains the bound scene node. ",[104,893,858],{"href":894,"rel":895},"https://threejs.org/docs/#api/en/core/Object3D",[108],[897,898,899],"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 .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}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);}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}",{"title":142,"searchDepth":149,"depth":163,"links":901},[902,903,906,907,908],{"id":119,"depth":163,"text":120},{"id":271,"depth":163,"text":272,"children":904},[905],{"id":464,"depth":173,"text":465},{"id":538,"depth":163,"text":539},{"id":780,"depth":163,"text":781},{"id":842,"depth":163,"text":843},"The real-time simulation of rigid-bodies subjected to forces and contacts is the main feature of a physics engine for video-games, robotics, or animation.","md",null,{},true,{"title":31,"description":909},"a1oNQe_tG5XvQU-18OOUMPKf_8HUoxl5tBYilU07vh8",[917,919],{"title":28,"path":24,"stem":29,"description":918,"children":-1},"The main component for render.",{"title":37,"path":38,"stem":39,"description":920,"children":-1},"Automatically generated colliders that fit your mesh shape when a RigidBody is created, with support for cuboid, ball, capsule, and other preset shapes.",1781680040528]