- Home /
Seamless planet transition with correct positioning
I have a setup of a solar system at a scale small enough that Unity can handle, but not large enough that the planets are realistically big enough to land on. I have the planets setup with a sphere colider that acts as a faux atmosphere and as you pass through it you get loaded into a new scene with the planet at a more realistic size. Then the reverse can happen an you can fly back into the solar system, this all needs some fine tuning to avoid loading screens.
What I have been wondering, how would I go about detecting where I entered the atmosphere so that I can spawn the ship in the corresponding point in atmosphere. At the moment there is just a hard set 'Spawn point', so it doesn't matter which side of the planet I approach it from I get spawned back at that one point.
Answer by IgorAherne · Jan 22, 2017 at 11:34 PM
1) stick collider on the atmosphere
2) make it a trigger
3) make sure your OnTriggerEnter(Collider colliderOfShip) gets called on the planet. Use colliderOfShip.transform.position to use as the spawnpoint.
or
compute the vector relative to the entered planet, by doing Vector3 shipPosRelativeToPlanet = planetTransform.worldToLocalMatrix.MultiplyPoint3x4(shipTransform.position)
worldToLocalMatrix
Matrix4x4
Your answer
![](https://koobas.hobune.stream/wayback/20220612105351im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to make a universe scenery 2 Answers
How do you calculate gravity from planets in a solar system? 6 Answers
Rigidbody gravity between planets 1 Answer
2D solarsystem lighting 0 Answers
How can I make something like Star Trek? 0 Answers