How would I create a hitbox in the shape of a pyramid?

I want to create a correctly working hitbox in the shape of a pyramid for my game. This hitbox will be used to detect characters within its bounds.

Traditional methods for hit detection often involve simple shapes like BlockCast or SphereCast. There are no functions like these, but with a pyramid shape.

What ideas do you have about this?

Shapecasts support meshes now, you can create a mesh in the shape of the pyramid and cast that instead. Here’s a video to guide you through this process:

Yes, I’ve been thinking about it. I have a ready-made meshpart pyramid. But I will add one more detail, that it is necessary to fire this hitbox from the face of a part.

You can use LookVector’s, UpVector’s, and RightVectors for this. If you want to fire the raycast from the front or back face, use the positive and negative LookVector of that part’s CFrame. For left and right use the positive and negative RightVector of that part’s CFrame. And for Top and Bottom faces, use the UpVector. The ray’s direction would be the vector multiplied by the distance you want the ray to travel, and the origin would be the part’s position.