Creates a camera-space canvas and displays ui objects on it that overlay the position of world-space objects.
C# GLSL ShaderLab
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Assets
ProjectSettings
.gitignore
LICENSE
README.md

README.md

canvas-overlay

Creates a camera-space canvas and displays ui objects on it that overlay the position of world-space objects.

Designed with the intent of using it as a VR HUD (everything that is projected it flat, which makes for a neat effect when viewed in VR) but can definitely be used in non-VR applications as well.

See Scenes/main.scene for a VR usage example

File explanations

  • Assets/Scripts/OverlayController.cs: Spawns the given overlay object prefabs onto the given canvas for each OverlayTarget
  • Assets/Scripts/OverlayItem.cs: Must be attached to the overlay object prefab. Is responsible for repositioning itself relative to the OverlayTarget it is assigned
  • Assets/Scripts/OverlayTarget.cs: Attach this script to any object that you want to overlay
  • Assets/Scripts/Utils.cs: Holds the function that translates world-space object coordinates to a canvas-space position

Example

Gif of the overlay in action