func (r *Ray) PolyCollide(s *Shape) (IsColliding bool, CollidingAt []*mgl32.Vec3, CollTri [][3]*mgl32.Vec3) {
	triang := make([]mgl32.Vec3, len(s.Triangulated))
	for i, v := range s.Triangulated {
		triang[i] = mgl32.TransformCoordinate(*v, s.ModelMat)
	}
	switch r.Type {
	case RAY_TYPE_CENTERED:
		InitVec := r.Pts[0]
		for i := 1; i < len(r.Pts); i++ {
			for j := 0; j < len(triang)/3; j++ {
				IsItColling, WhereIsIt := RayTriangleCollision([2]*mgl32.Vec3{InitVec, r.Pts[i]},
					[3]*mgl32.Vec3{&triang[3*j], &triang[3*j+1], &triang[3*j+2]},
				)
				if !IsColliding {
					IsColliding = IsItColling
					CollidingAt = append(CollidingAt, &WhereIsIt)
					CollTri = append(CollTri, [3]*mgl32.Vec3{&triang[3*j], &triang[3*j+1], &triang[3*j+2]})
				}
			}

		}
	}
	return IsColliding, CollidingAt, CollTri
}
// Takes a shape and check for collison the the ray r, if there is collision
// IsColliding is true, CollidingAt is where the collision happend and
// s can only be of type TRIANGLES, TRIANGLE_STRIP, TRIANGLE_FAN
Takes a shape and check for collison the the ray r, if there is collision
IsColliding is true, CollidingAt is where the collision happend and
s can only be of type TRIANGLES, TRIANGLE_STRIP, TRIANGLE_FAN
// Takes a shape and check for collison the the ray r if there is collision // IsColliding is true CollidingAt is where the collision happend and // s can only be of type TRIANGLES TRIANGLE_STRIP TRIANGLE_FAN
func (r *Ray) PolyCollide(s *Shape) (IsColliding bool, CollidingAt []*mgl32.Vec3, CollTri [][3]*mgl32.Vec3) {
	triang := make([]mgl32.Vec3, len(s.Triangulated))
	for i, v := range s.Triangulated {
		triang[i] = mgl32.TransformCoordinate(*v, s.ModelMat)
	}
	switch r.Type {
	case RAY_TYPE_CENTERED:
		InitVec := r.Pts[0]
		for i := 1; i < len(r.Pts); i++ {
			for j := 0; j < len(triang)/3; j++ {
				IsItColling, WhereIsIt := RayTriangleCollision([2]*mgl32.Vec3{InitVec, r.Pts[i]},
					[3]*mgl32.Vec3{&triang[3*j], &triang[3*j+1], &triang[3*j+2]},
				)
				if !IsColliding {
					IsColliding = IsItColling
					CollidingAt = append(CollidingAt, &WhereIsIt)
					CollTri = append(CollTri, [3]*mgl32.Vec3{&triang[3*j], &triang[3*j+1], &triang[3*j+2]})
				}
			}
		}
	}
	return IsColliding, CollidingAt, CollTri
}
func ( r * Ray ) PolyCollide ( s * Shape ) ( IsColliding bool , CollidingAt [ ] * mgl32 . Vec3 , CollTri [ ] [ 3 ] * mgl32 . Vec3 ) { triang := make ( [ ] mgl32 . Vec3 , len ( s . Triangulated ) ) for i , v := range s . Triangulated { triang [ i ] = mgl32 . TransformCoordinate ( * v , s . ModelMat ) } switch r . Type { case RAY_TYPE_CENTERED : InitVec := r . Pts [ 0 ] for i := 1 ; i < len ( r . Pts ) ; i ++ { for j := 0 ; j < len ( triang ) / 3 ; j ++ { IsItColling , WhereIsIt := RayTriangleCollision ( [ 2 ] * mgl32 . Vec3 { InitVec , r . Pts [ i ] } , [ 3 ] * mgl32 . Vec3 { & triang [ 3 * j ] , & triang [ 3 * j + 1 ] , & triang [ 3 * j + 2 ] } , ) if ! IsColliding { IsColliding = IsItColling CollidingAt = append ( CollidingAt , & WhereIsIt ) CollTri = append ( CollTri , [ 3 ] * mgl32 . Vec3 { & triang [ 3 * j ] , & triang [ 3 * j + 1 ] , & triang [ 3 * j + 2 ] } ) } } } } return IsColliding , CollidingAt , CollTri }
Takes a shape and check for collison the the ray r, if there is collision
IsColliding is true, CollidingAt is where the collision happend and
s can only be of type TRIANGLES, TRIANGLE_STRIP, TRIANGLE_FAN
Takes a shape and check for collison the the ray r if there is collision IsColliding is true CollidingAt is where the collision happend and s can only be of type TRIANGLES TRIANGLE_STRIP TRIANGLE_FAN