Skip to content

SceneManager::calculateSceneRight() assumes right handed coordinate system #432

@jdswebb

Description

@jdswebb

Describe the bug

As of version 0.4.1, calculateSceneRight is implemented as:

  Vector3 SceneManager::calculateSceneRight() {
    return cross(getSceneForward(), getSceneUp());
  }

This assumes a right hand coordinate system, i.e. with forward = {0,0,1} and up = {0,1,0} it returns {-1,0,0}. The function is currently only used in the terrain baking, and it means that the view matrix for the baking is computed incorrectly for games that use a left handed coordinate system.

A simple fix would be to expose the coordinate system of the game as a config option and change it along of the lines of:

  Vector3 SceneManager::calculateSceneRight() {
    return isRHCoordinateSystem ? cross(getSceneForward(), getSceneUp()) : cross(getSceneUp(), getSceneForward());
  }

I tested this fix out for 'Star Wars Galaxies' and the result was the terrain baking worked correctly. Perhaps there is a smarter way to infer the coordinate system without needing user input though.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingruntimeRTX Remix runtime

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions