0 votes

Hi!

I'm trying to get the contact points between a RectangleShape2D and a SegmentShape2D. I'm using the collideandget_contacts function. The problem is that sometimes the result is not as expected.

In the attached gif you can see that when the segment is completely inside the rectangle one of the points does not mark the end of the segment but the intersection between the segment's extension and the rectangle.

error 1

Something similar happens when the segment is larger than the rectangle and the points of contact are two.

error 2

Is it an engine error or should I follow another way (maybe clipping techniques) to get what I want? In that case, how could I solve it?

Thanks in advance

in Engine by (16 points)
edited by

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 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 webmaster@godotengine.org with your username.