DynamicAlcove.cs

Dynamically creates a 3D alcove environment around the HologramCamera in Unity. Supports runtime updates, adjustable dimensions, and subdivided meshes for improved visual quality.

Fields & Properties

float borderThickness

Thickness of the borders. Default: 0.01f

float backWallDistance

Distance of the back wall from the camera. Default: 1.0f

Material boxBGMaterial

Material applied to the alcove walls.

int meshSubdivisionsX

Number of subdivisions along the X-axis for wall meshes. Default: 2

int meshSubdivisionsY

Number of subdivisions along the Y-axis for wall meshes. Default: 2

bool showInHierarchy

Whether to display walls in the Unity hierarchy. Default: false

Methods

void RecreateBox()

Destroys and recreates the alcove walls based on the HologramCamera calibration.

void CreateBox(float cameraSize, float screenAspect)

Constructs the alcove walls and borders around the camera.

  • float cameraSize: Size of the camera.

  • float screenAspect: Aspect ratio of the screen.

void DestroyBox()

Destroys all walls in the alcove.

GameObject CreateWall(string name, Material material, Transform parent)

Creates a single wall with the specified material and parent transform.

  • string name: Name of the wall.

  • Material material: Material to apply.

  • Transform parent: Parent transform.

  • Returns: A GameObject representing the created wall.

Mesh CreateSubdividedQuad(Vector3 bottomLeft, Vector3 bottomRight, Vector3 topLeft, Vector3 topRight, int subdivisionsX, int subdivisionsY )

Creates a subdivided quad mesh for better shadow rendering.

  • Vector3 bottomLeft: Bottom-left corner of the quad.

  • Vector3 bottomRight: Bottom-right corner of the quad.

  • Vector3 topLeft: Top-left corner of the quad.

  • Vector3 topRight: Top-right corner of the quad.

  • int subdivisionsX: Number of subdivisions along the X-axis.

  • int subdivisionsY: Number of subdivisions along the Y-axis.

  • Returns: A Mesh of the generated quad.

Last updated

Was this helpful?