Skip to content

Commit

Permalink
Add Capsule collider
Browse files Browse the repository at this point in the history
  • Loading branch information
LD2Studio committed Sep 21, 2024
1 parent 7ba487e commit 59901d8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/jsm/physics/Rapier.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ function getShape( geometry ) {
const radius = parameters.radius !== undefined ? parameters.radius : 1;
return RAPIER.ColliderDesc.ball( radius );

} else if ( geometry.type === 'CapsuleGeometry' ) {

const radius = parameters.radius !== undefined ? parameters.radius : 1;
const halfHeight = parameters.length !== undefined ? parameters.length / 2 : 0.5;
return RAPIER.ColliderDesc.capsule( halfHeight, radius );

} else if ( geometry.type === 'BufferGeometry' ) {

const vertices = [];
Expand Down

0 comments on commit 59901d8

Please sign in to comment.