[SOLVED] Multiple level buildings inside/outside roofs

I am nearing completion of a structure I have created that represents 4 game levels with each level also representing a level in height change such as second floor, third floor, 4th floor. When the levels are all combined they reveal a completed structure, inside and out.

I am trying to decide how organize the levels in game to efficiently implement a no roofs option with a third person view.

I know I can traverse the scene and toggle Alpha for textures but I would think this to be an error prone approach.

I was thinking that I might need to create a shell for the structures that chars see when outside and move the char to the inside of the level when appropriate but that seems like your duplicating a ton of geometry.

Any suggestions on a efficient no-roofs option with third person view?

I assume you are looking for something fancier than toggling the cull hint for the levels above the player every time they switch to a new one?

If so, what kind of fancier?

Basically, I would like for the whole structure to show when outside if roofs are toggled and only the level (as in floor) when inside.

When inside, surrounding buildings within the view limit would reveal only the floor the char is on.

Unless Iā€™m misreading something, the simple way to do this (to me) is to organize your buildings into level nodes and give those nodes a ā€œlevelā€ user data.

Whatever you do you will need to keep track of which floor a user is on anyway (unless thatā€™s what you are asking how to do). Whenever they switch floors, find the current level they are on, iterate down from the root node until you hit a node with a level and toggle itā€™s cull hint Always or Inherit depending on if that level should be visible or not.

1 Like

I see. That gets rid if the other levels.

Lets say the char is inside and thereā€™s a roof over part of the level. Would you just toggle the Alpha for texture of the roof ?

Edit: or best to use FaceCullMode.FrontAndBack.

I think I get it. Cull will be more efficient.

Yepā€¦ wonā€™t even be sent to the GPU. Also, nothing in that particular level will go through normal cull checking, etcā€¦ itā€™s a very efficient way to ā€˜cullā€™ (ahem) parts of the scene. :slight_smile:

Thank you.

1 Like