(Sorry for the weird name, I struggled to find one
- What do you want to achieve?
I want to check if a part is partly inside a cone shape (Think NPC Field of view)
- What is the issue? Include screenshots / videos if possible!
Currently my code only detects the origin of the object, and not if a corner is inside the cone.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Dot Product - Currently I’m using dot product, where I use the direction between the purple part and blue part, and the lookvector of the purple block. After that I check if the dot product is within the angle. Problem is this doesn’t work if the parts origin isn’t inside the angle.
Clamped raycasting - I clamped the direction between the blue part and purple part of the raycast to only be within the cone’s angle. It did work, however I’d like to find if there is anything less performance-heavy (I know it isn’t very performance heavy, but hundreds each frame wouldn’t be the best)
Weird PartsInPart + Cone mesh deformation - Haven’t actually put this into action, but maybe I could try to make a literal cone mesh and deform it into whatever angle I need, then just GetPartsInPart, however this likely will be the least optimized version.