Hi everybody. I apologize in advance, I am writing through a translator.
I have a project in godot 4 3D. There are two scenes in it: the “main scenes” and the “street” where the doors are located.
How do I make it so that when I approach the door in one scene, I am transported to another scene with certain coordinates.
I assume this is done through marker 3D, but I don’t understand how to do it.
If it’s not difficult, write in more detail.
The concept of such a scene transition is based on Collision.
Your character is on a specific Collision Layer.
Your first goal is to create an Area3D which has a CollisionShape of the area that you want your player to touch. This CollisionShape has the Collision Mask of the same value as your Character’s Collision Layer.
Then you make use of the “on_body_entered” Signal of the Area3D.
You first check if the body is the Player, then you trigger the scene change.
For the position, you may want to make use of an Autoload that sets a Vector3 position. Autoloads are global variables that can be accessed everywhere in your code and whose values dont vanish if you change scenes.
Each Area3D scene transition object should have a hardcoded “destination_position”.
In your Street or MainScene scripts, your _ready() method should set the position of the player based on what position is saved in your Autoload.