-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rounded Corners Rect support? #7
Comments
Can you share more about use cases for rounded rectangles? Right now this could be approximated with a polygon, or (naively) created with a compound body. If you're aware of any other 2d physics engines that have support for rounded rectangles, that would be useful for reference too. |
@isaac-mason Well, it would practically work as a capsule... It could be very useful for top down games, platform games or any other game that wants to have some shape variations giving a more "pixel perfect" impression. |
Thanks @runtothedoor. I don't have time to drive implementation for this right now. If someone wants this and is willing to contribute some code, in the short term I can give guidance and help with reviews and testing. I might get some time for this in the coming months. In the meantime, I'll leave this issue open. Feel free to share more about use cases, ideas for implementation, other physics libraries that support this shape, etc. If it's useful, I can create some examples for how to approximate this shape too, let me know. |
An approximate example of the shape would be perfect. Currently I don't have that much time available either but I will try to contribute to the implementation of this feature soon. |
Okay great :) I am away from home for a while, but putting together an example for this is on my to-do list for when I'm back. |
The matter-js lib provides a utility that takes vertices for a polygon, and returns vertices with rounded corners, with configurable quality. See A similar approach could be used in user-land with p2-es. Having full support for rounded rects with their own narrowphases is a notable amount more work. The polygon approach likely covers 99% of use cases. If there's interest, something similar could be added to p2-es. |
No description provided.
The text was updated successfully, but these errors were encountered: