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

How can I spawn my ship directly on a planet? #16

Open
sagersmith8 opened this issue May 4, 2024 · 1 comment
Open

How can I spawn my ship directly on a planet? #16

sagersmith8 opened this issue May 4, 2024 · 1 comment

Comments

@sagersmith8
Copy link

Description

I've I am wondering how to do about spawning the ship on the surface of earth. Moving the spawnPoint doesn't seem to do anything, and its unclear how to get the position of a StellarBody

@Zylann
Copy link
Owner

Zylann commented May 5, 2024

Currently you can't do that without changing any of the scripts. The demo wasn't setup to do this.

In order to spawn on earth, you can't actually place a spawn point in the scene. Planets are created and simulated from code.
Assuming you have a longitude/latitude you want to spawn at, it may be possible to spawn the player in a disabled state at a "best guess" location (taking planet radius into account), and then wait for ground to load around. As loading happens, a raycast may be used to determine a good location above ground once it loads, and move the player there. Finally, the player could be enabled once conditions are right (that can be as soon as ground collision is detected, or when the area becomes editable).
The demo also handles origin shifting when getting close to planets. There might be something to take into account there if the player starts directly on a planet, but I'm not sure.

You will need to dig into the source to figure out how to do this.

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