KeenSoftwareHouse / SpaceEngineers

2.93k stars 896 forks source link

Fix for meteors spawning underground, partial #532

Open progfz opened 8 years ago

progfz commented 8 years ago

When in planet gravity and sun is below surface, meteors will spawn from direction opposite to sun. It makes meteors much less likely to spawn underground but is not a complete solution - deep underground bases and bases on mountain hills still could be affected.

fabricator77 commented 8 years ago

Wonder what happens at the equator though, where the meteors would be travelling parallel to the surface.

Jimmacle commented 8 years ago

@fabricator77 As OP said, it's only a partial fix because asteroids coming from within the planet are far worse than odd meteor trajectories.

@progfz What if you calculated a direction using the player and the center of the gravity source? That way they will always travel straight at the surface. Having meteors come from the sun all the time is a strange phenomenon in the first place :stuck_out_tongue:

progfz commented 8 years ago

@fabricator77 why should they be parallel to surface at equator? With original logic meteors always come from sun and my addition is only reversing that direction if angle between reversed gravity and direction to sun is greater than 90 degrees. Parallel trajectories will happen when direction to sun is nearly parallel to surface, just as how it's in default implementation.

@Jimmacle it's nothing hard to implement by taking reversed normalized vector of gravity instead of direction to sun and leaving all other calculations as is. But meteors from the sun are current way of how things are working so I just based my calculations on it. In my opinion things should be done not in a rush but rather one step at a time - for example, first to resolve most broken part of underground meteors and then to start thinking about more complete fix or even about feature overhaul, in this way if first pull request is accepted it will give biggest immediate impact with minimal efforts while gathering feedback and ideas for future iterations.

BTW, currently meteor showers are not bound to player but rather to block grids near player, if I understood code correctly, and showers already have central point that could be used for all kinds of calculations instead of player position.