Set an oval collider in Unit 3/Game Lab

Link to the project or level: Code.org

What I expect to happen: Change collider type to an oval by selecting a “circle” collider type, and setting a width/radius AND height.

What actually happens: ERROR: Line: 6: TypeError: Usage: setCollider(“circle”[, offsetX, offsetY[, radius]])

What I’ve tried: The circle collider type only works with a perfect circle, not an oval.

The documentation for setCollider heavily implies that you can create an oval by setting the width and height. From the error messages we get, it seems clear that the circle collider type only uses parameters 2-4, and dismisses 5-6.

Am I missing something, and/or is there a backend issue that makes creating an oval “circle” collider impossible to do? Is it an issue only in

“The width of a rectangle collider or the radius of a circle collider. The default is determined by the size of the sprite.”
“The height of a rectangle collider or the radius of a circle collider. The default is determined by the size of the sprite.”

Hi @hayest,

Interesting. I believe you are correct. When you change to circle collider, it dismisses the height and width parameter and only utilizes a singular radius. My interpretation of the documentation was that the rectangle collider is the default (and therefore height and width an option) but a circle collider (with only one argument) can be chosen if you wish to have a smaller collider. But that was just my interpretation. As for the reasoning and further information, you can contact support and they may be able to give you further information.

~Michelle

1 Like

Just a quick update. I heard from Support. It’s a known issue, and there’s no immediate plans to make a feature change. I did make the suggestion to update the documentation to make this more clear. Below is the response I received from support. Thanks all!

Hello,

Thank you for contacting Code.org!

We appreciate you reporting this error in our documentation!

Our team is aware of this and they are actively working on a fix to that documentation. We sincerely apologize for any inconvenience.

These reports help us make our site and offerings better for everyone, so thanks again for taking the time to send us this information!

At this time, we do not support oval colliders, however we appreciate your feedback about this and will pass it along to the team.

If you have any additional questions, please let us know.

I’m glad you reported and updated here. Thank you.