Setting up an Apartment in the Block Editor
From Blue Mars Developer Guidebook
Back to Tutorials
Apartment Residences allow a Block Owner to set up multiple residences with minimal effort and minimal performance loss to their city. The interior geometry for an apartment is actually stored as an item (with the same limitations as all items) and spawned on demand for a player when they select to enter their residence. This means that the interior geometry is not being rendered by the rest of the players in the city and when the player leaves their room it is removed from the world again so they are not rendering it either.
What You Need
Setting up an ARApartment in Block Editor
Drag out an ARApartment (Entity>Others/AR/ARApartment). You can place it anywhere within the block, up in the air or inside of a building. It's up to you. Just make sure no other geometry intersects the room or the user will end up with that geometry in their living room.
- DbUniqueId - Leave this alone because it will be set up by the database.
- radius - Deprecated
- RoomType - This is size of interior allowed in this space. Make sure no other geometry intersects this box or it will show up in the middle of the apartment.
Setting up an ARInteriorTester in Block Editor
Drag out an ARInteriorTester (Entity>Others/AR/ARInteriorTester) To the entrance of your Apartment Structure. By default the ARInteriorTester does not have a model you'll need to set up the entity using the following settings.
- Address - The name of the ARApartment ("Block1_Apartments")
- Model - A physicalized .cgf (I usually use a model of a door but it could be anything with a physics proxy)
- RoomID - Just leave this as 0.
- Spawnpoint - This is the name of your exterior SpawnPoint (i.e."Block1_ApartmentExteriorSpawn")
Setting up an exterior SpawnPoint
Now we need to place an ARInteriorSpawnPoint (Entity>Others/AR/ARInteriorSpawnPoint) outside the front door or wherever you'd like to place the player when they exit the Apartment. The only thing you need to do is name this something relevant and unique so something like "Block1_ApartmentExteriorSpawn".
One of the advantages of using apartments is that it allows the user to set their own Interior. Interiors are simply an item a user can buy and then apply to their apartment using the House Inventory.
For more information on creating interiors refer to Blue Mars Sandbox Interior Editor