Skip to content

Conventions

Kane Rogers edited this page Sep 20, 2022 · 7 revisions

Introduction

Background

image

Everyone loves conventions! What could be more exciting than splitting hairs about the smallest difference in meaning between two words?

In this document we try to outline our motivations behind conventions in general, some guidelines to use when creating them and, of course, an always incomplete list of the conventions we use inside the engine today.

Motivations and goals

Why have conventions to begin with? The idea is to follow the principle of least surprise. If I access a variable called position, I wouldn't, for example, expect to get that object's velocity.

That makes sense - the variable should give you something you expect. But what if position returns an Isometry3 in one case and a Vector3 in another? I would be very surprised!

Therein lies the real magic of conventions - they enforce consistency. As long as names are used consistently throughout a codebase, the actual name itself doesn't matter.

Conventions

Spaces

A space refers to a specific frame of reference for a coordinate system. When we say that an object has a translation of 10 on the x axis, it's 10 meters away from some specific origin point. We use a couple different spaces in Hotham:

  • global refers to the space sometimes called "world space" in other engines. It's a space shared by all objects with some arbitrary origin.
  • stage refers to a space whose origin is the location of the player's headset, with respect to the centre of their guardian (or stage, in OpenXR parlance)
Clone this wiki locally