@@ -153,21 +153,22 @@ func (b *Box) GetContactFeature(direction mgl64.Vec3, output *[8]mgl64.Vec3, cou
153153 halfSize := b .HalfExtents
154154
155155 // Générer les 4 coins selon la face
156- if bestAxisIdx == 0 { // Face X
156+ switch bestAxisIdx {
157+ case 0 :
157158 x := sign * halfSize .X ()
158159 output [0 ] = mgl64.Vec3 {x , - halfSize .Y (), - halfSize .Z ()}
159160 output [1 ] = mgl64.Vec3 {x , - halfSize .Y (), halfSize .Z ()}
160161 output [2 ] = mgl64.Vec3 {x , halfSize .Y (), halfSize .Z ()}
161162 output [3 ] = mgl64.Vec3 {x , halfSize .Y (), - halfSize .Z ()}
162163 * count = 4
163- } else if bestAxisIdx == 1 { // Face Y
164+ case 1 :
164165 y := sign * halfSize .Y ()
165166 output [0 ] = mgl64.Vec3 {- halfSize .X (), y , - halfSize .Z ()}
166167 output [1 ] = mgl64.Vec3 {- halfSize .X (), y , halfSize .Z ()}
167168 output [2 ] = mgl64.Vec3 {halfSize .X (), y , halfSize .Z ()}
168169 output [3 ] = mgl64.Vec3 {halfSize .X (), y , - halfSize .Z ()}
169170 * count = 4
170- } else { // Face Z
171+ default :
171172 z := sign * halfSize .Z ()
172173 output [0 ] = mgl64.Vec3 {- halfSize .X (), - halfSize .Y (), z }
173174 output [1 ] = mgl64.Vec3 {halfSize .X (), - halfSize .Y (), z }
@@ -247,7 +248,7 @@ func (s *Sphere) GetAABB() AABB {
247248// ComputeMass calculates mass data for the sphere
248249func (s * Sphere ) ComputeMass (density float64 ) float64 {
249250 // Volume of sphere = (4/3) * π * r³
250- volume := (4.0 / 3.0 ) * math .Pi * math . Pow ( s .Radius , 3 )
251+ volume := (4.0 / 3.0 ) * math .Pi * s . Radius * s .Radius * s . Radius
251252
252253 return density * volume
253254}
0 commit comments