smcameron / space-nerds-in-space

Multi-player spaceship bridge simulator game. Captain your starship through adventures with your friends. See https://smcameron.github.io/space-nerds-in-space
GNU General Public License v2.0
729 stars 73 forks source link

Phaser shot get rendered above asteroids #191

Open MCMic opened 5 years ago

MCMic commented 5 years ago

Not sure this is the exact description of the problem, but basically when you shoot an asteroid (which all newcomers to the weapons station do at least once), it feels as if the phaser goes through the asteroids, but it’s even weirder than that since it get rendered on top of it even if it’s behind, making distances feel completely wrong.

I guess there is the same thing for planet surfaces but as it’s harder to evaluate distance it’s less shocking.

smcameron commented 5 years ago

Are you sure the asteroid isn't a lot bigger than you think?

Try this lua script:

player_ids = get_player_ship_ids();
x,y,z = get_object_location(player_ids[1]);
a = add_asteroid(x + 1500, y, z);
set_asteroid_speed(a, 0);

It will create a stationary asteroid 1500 units from your ship. Your phaser has a range of 3000 units.

You can also look on the 3D demon screen with exaggerated scale disabled and get an idea of the relative size of your ship and the asteroid.

Here's what an asteroid looks like on the demon screen. The pink circled thing labeled REVENGE is my ship. The amber thing is an asteroid.

screenshot from 2019-02-04 17 29 44

Here's the same thing viewed from weapons perspective:

screenshot from 2019-02-04 17 30 17

From what I can tell, the phasers seem to render ok to me -- they pass into the asteroid, but are not rendered on top of the surface.

There is no collision detection with the surface though.

MCMic commented 5 years ago

Hum not sure, it still feels wrong to me, the phaser "bullet" end up a few pixel large before disappearing, I would expect it to "impact" a lot sooner. I feels a lot better with torpedos in this scripted case I do see them disappearing inside the asteroid.

I may just be too confused about scales, speed and distances, I’m not used to going into space…