Object origin shifts when added from a hidden layer to the active layer upon game start

I’m in the process of making interconnected rooms for a game world. The rooms are separate objects kept on a hidden layer and are summoned to its corresponding ‘empty object’ on the active layer upon a player’s collision with an object (in this case a door). The logic looks something like this.

  1. Object with the “player” property collides with object named “door A-1/ A-2”.
  2. “door A-1/ A-2” sends out message with subject “load room A-2”, the object then ends itself.
  3. Empty object named “Empty A-2” receives message with subject “load room A-2” triggering the Add Object actuator.
  4. Object named “room A-2” (located on a hidden layer) is added to the active layer at the location of “Empty A-2”.

The issue I am having is that when I start the game engine, the door object’s origin gets shifted from its original position. However when I am viewing it in the 3D View Port, everything is in the correct place. If I’m viewing both the active and hidden layers and start the game engine, everything is still in the correct place. Every object has the scale and rotation applied to it.

If you need clarification on something, please ask, I’m reasonably quick at responding.
Thank you.

Maybe a .blend file would help here :slight_smile:

Are you using object groups?

No I am not using object groups. Could you please explain how/ why that can help with this, I don’t know much about it.
In terms of the blend file the best I can do right now is give a slightly older backup file as the current one is located on a school drive. Here is the file: waterfall area.blend (691.6 KB)

On my end, I don’t see any issues with the doors :confused:

Used UPBGE 0.2.4, just pressed P in what looks like the main scene and layer.

By the way, that really looks like some Metroid Prime kind of level, that’s so cool!

Okay right off the bat. THANK YOU!!! :smiley::laughing:
That is exactly the style I was shooting to achieve.
Some of the rooms I had manually adjusted to kind of fit. Did all of ones near the big room with pillars work?

On my end, it looks like the door has indeed an offset, but it looks this way in the editor without me doing anything, is it normal?

Yes. In order for it to load in the proper place during the game, I had to move doors and empties into different spots for it to line up with the entrance and exits to rooms. If you were to place the door in what looks like should be the correct position and start the game, the door will be in the wrong position.

If this doesn’t happen, could it be that your using UPBGE and I used vanilla Blender 2.79?

It looks weirder than that as the door just disappears when I launch the game…

I cannot help more, but maybe it is something with your game logic?

In order to line up the objects good enough to look decent, I have to start the game and load the rooms manually then see how far/ what direction it needs to be moved in. While this works, it eventually will be impracticable because it takes too long already (upwards of 5 to 10 minutes to get it almost perfect). I only have roughly 50 minutes each class, and I only have the about 4 times a week. This eventually will take to long to continue doing it that way.

I initially thought that too, but what probably happened is that it was moved out of sight from the gap opening. That’s why they are placed like that in the editor. So that when it moves it will kind line up with the objects it should.

also using upbge 0.2.4

the following errors occur:

Warning: object "A-3 Empty" from AddObject actuator "Edit Object" is not in a hidden layer.
Warning: object "Empty A-2.001" from AddObject actuator "Edit Object" is not in a hidden layer.
Warning: object "Empty A-1" from AddObject actuator "Edit Object" is not in a hidden layer.

The door (only can see the first one, rest of your level disappears) has it’s origin not on it center, this causes an offset when you spawn it to the spot of the empty.

To fix this:

  • select object
  • tab into edit mode
  • press A to select all
  • hit shift+s
  • select 3d cursor to selected
  • press tab to go out of edit mode
  • hit ctrl+shift+alt+c and select origin to 3d cursor

The origin (orange dot) should now be in its center, that dot will be placed on the empty location when you spawn it.

Other then that no clue, due to i can’t see anything after the first door.

Thank you, I’ll look into that as soon as I get the chance. :slightly_smiling_face: