C# - 如何检查对象是否在椭圆等有限区域内?
我有一个定义的椭圆形状,但是,无法弄清楚如何检查目标/对象是否位于该椭圆区域内。
例如,这就是我抓取定义的圆形物体的方法。在Unity中...
Collider2D[] targetsInRadius = Physics2D.OverlapCircleAll(Circle.position, Radius, targetMask);
这只有效,因为圆有一个半径,但是椭圆有两个半径,其中一个比另一个长。 unity 是否有与上面的省略号代码相同的东西。
如果有帮助的话,我有一个包含定义椭圆形状的顶点/线段的 Vector3 数组。
如何检查目标是否在椭圆内?
I have a defined ellipse shape, however, can't figure out how to check if a target/object is within this ellipse area.
For example this is what I did to grab objects in defined circle shape. In Unity...
Collider2D[] targetsInRadius = Physics2D.OverlapCircleAll(Circle.position, Radius, targetMask);
This only works because circles have a single Radius, However ellipse has two radius where one is longer than the other. does unity have something equivalent to the above code for ellipses.
If it helps I have a Vector3 array containing the vertexes/segment defining the ellipse shape.
how do I check if target is within ellipse?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论