Page 1 of 1

Separate 2 colliding objects.

Posted: Mon Sep 25, 2023 7:38 pm
by ddabrahim
Hi all!

I have implemented HardonCollider in my project to allow me to rotate colliders and detect collision with the rotation taken in to account.
However, it is introduced me to a new challenge when I try to detect where exactly the collision occurs and move object away from an other.

I have attached a screenshot of the scenario I am trying to solve. The red rectangle is the collider I think it is clearly visible where the collision occur between the two object. The object is moving toward the green arrow and the task I am trying to solve is to allow the object to continue to move toward the green arrow but at the same time also move it away toward the black arrow away from the point of collision:
collision.png
collision.png (25.61 KiB) Viewed 7756 times
HardonCollider seems to not include any way to know where exactly the collision accour and without this information I have no idea how to find the angle to move the object away to.

Is there any library that could potentially take the polygons and help me calculate the angles, point of collision?
Or is there anyone who could point me in the right direction how to solve this with a math formula or any library?

I would appreciate any help.

Thank you.

Re: Separate 2 colliding objects.

Posted: Mon Sep 25, 2023 7:43 pm
by darkfrei
Sliding point along the line:

viewtopic.php?p=255011#p255011
Image

Re: Separate 2 colliding objects.

Posted: Mon Sep 25, 2023 8:08 pm
by ddabrahim
Seems exactly what I needed.
Thanks a lot for the quick reply :)