0 votes

I've made a prism-shaped ConvexPolygonshape3D with points at [(0, 0.5, 0.5), (0.5, -0.5, 0.5), (0, 0.5, -0.5), (-0.5, -0.5, 0.5), (0.5, -0.5, -0.5), (-0.5, -0.5, -0.5)], so with triangular faces aligned with the z-axis at 0.5z and -0.5z on either side. 1

I set up a plane along xy, [N: (0, 0, 1), D: 0]. When I call Geometry.clip_polygon(points, plane), what I'd expect based on the description is that it would bisect the shape along the xy plane and return vertices [(0, 0.5, 0), (0.5, -0.5, 0), (0, 0.5, -0.5), (-0.5, -0.5, 0), (0.5, -0.5, -0.5), (-0.5, -0.5, -0.5)].

But what it actually returns is [(-0.25, -0, -0), (0.25, 0, -0), (0, 0.5, -0.5), (-0.25, 0, -0), (0, -0.5, -0), (0.5, -0.5, -0.5), (-0.5, -0.5, -0.5)], so where the plane is cutting the new shape has been shrunk rather than neatly bisected preserving the edges.

I'm not sure if this is what it's supposed to be doing or if I've misunderstood what it's supposed to do or misapplied it somehow. If Geometry.clip_polygon isn't the way to bisect some geometry along a plane without, then is there a method that can do that without distorting it?

Godot version 4.0
in Engine by (17 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.