WARNING: Words wall!
Hello every one! I hope I can get your scripting skills help on this one.
I need to fly from a planet to another. In my previous demo that was a bit possible, but it was from the same planet’s moon to another. For the game, there’s a need to explore a star system, if not many of them, in an almost seamless way. I know you might at first think it’s impossible, but I not the kind of guy who shows up and asks for impossible stuff to the other, such a fake up system is being hold for my lack of experience in python-fu.
So how so I go about it?
In my ideal setup, I’d have a star system with it’s planets in a background scene. there I have a camera flying about in space.Each planet has the same orbital space, which is determined by the biggest planet.
Then on the main scene I have another camera and a ship. There’s a planet spawner in the middle of the scene and a position controller.
When the camera approaches the planet, a position controller object is added, and it tracks to the camera, this object orientation is then linked to the main scene’s posController, since the camera is parented to that controller, both cameras will have the same relative angle to the planet. In which case the planet seems to spawn on the right side. As for the distance, the cameras need to have a relative position script that calculates the vector length from the controller to the camera and set’s it to the other camera X 1000.
So far, the first part works, but because there’s no distance calculation, landing on the planet is very awkward (not impossible) I provide a simple blend example without landing nor approaching planets. I was incapable of making it work from background to foreground. Therefore the main scene runs in overlay.
The script I’m using, courtesy of Raiderium, uses a position line, but since it takes the world position, I can’t use that!
The current setup has got precision problems. I figured it was because of the lack of distance to target calculation/attribution.
This image shows what happens after orbiting the planet a few times
Although it’s fine when the planet is spawned
A more sophisticated script.
Containing a linking list of objects in the scenes, a 1 pivot point (reference object) per scene and vector lenght calculation to the object in the scene. Attribution of this length to the corresponding object in the main scene [ the main scene being 1000X bigger than the background’s, the length is mult by 1000). Also their orientations must be copied. This has to work from the background to the main scene. Meaning that the background is the source of information.
BTW, the same principle is applicable for a 3D radar!
If you read this far, means that you are patient and might be willing to help a distressful fellow. Please help!
player pos rev.blend (322 KB)