Skip to content
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

Logos can appear within the Mozilla logo area #2

Open
Standard8 opened this issue Oct 23, 2017 · 6 comments
Open

Logos can appear within the Mozilla logo area #2

Standard8 opened this issue Oct 23, 2017 · 6 comments

Comments

@Standard8
Copy link

I was watching the screensaver for a few minutes, and noticed that you can get logos inside of the Mozilla logo. It seems to happen if it is rotating and the small logo randomly happens to appear where the Mozilla logo is.

They get trapped and can't get out.

@justdave
Copy link

Having them spawn higher on the screen might look better anyway. When I run it a lot of them seem to spawn already sitting on top of the logo instead of higher on the screen and falling to land on it.

@Standard8
Copy link
Author

#3 changes the initial height which, I think, would avoid conflicts on my bigger screen. However my MacBook screen still looks like it could still spawn items within the logo when it is rotating.

So we probably do want to fix this, or maybe adjust the size of the Mozilla logo according to the scren, so that the other logos will always spawn above it (not sure if this would make it too small though).

@justdave
Copy link

probably need to change the object definition for the main logo to make it a solid object instead of an outline for the collision detection. Because then if it spawns inside it the collision detection would cause them to attempt to separate. I think. Haven't done much with that stuff so kinda guessing.

@Standard8
Copy link
Author

I happened to take a look at that last night - as I was playing around with dips either side of the "o" to generate a bit more interest (See #4 though I'm undecided if that's better than a plain flat section).

In working through it, I saw the code for SKPhysicsBody bodyWithPolygonFromPath and took a look. The SKPhysicsBody docs are here https://developer.apple.com/documentation/spritekit/skphysicsbody

Unfortunately, polygons appear to only be able to be convex, so you end up with something that slopes down from the top of the '//' to the outsides of the 'm' and 'a' either side, hence the logos just roll off rather than build up.

I also saw a couple of other things overnight: At one point I'm fairly sure I saw a couple of logos resting on the end as it rotated, which then "slipped" into the Mozilla logo part. I also saw one that managed to slip out as well. I'm therefore suspecting there's some scaling issues when rotating the image that can mean that the paths don't always align perfectly, hence letting logos slip in.

@justdave
Copy link

The other idea I had was if there's a way to manually detect if an object is inside of an edge loop you could test for that immediately after spawning a logo and manually move it in a specific direction until it's no longer inside the edgeloop or something.

@justdave
Copy link

is there a way to create multiple polygons and then tell the engine that they're permanently attached to each other?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants