Table of Contents

Fixing Objects to a Camera (great for UI)

Handy for using UI Objects, and fixing them to the Camera. If the Camera changes position, the child UI Objects move with it, giving the impression of being fixed into place. This example does not use relative parent space: UseParentSpace = false

Code

orxViewport_CreateFromConfig("Viewport");
orxObject_CreateFromConfig("ScoreObject");

Config

[Viewport]
Camera        = Camera
 
[Camera]
FrustumWidth  = 800
FrustumHeight = 600
FrustumFar    = 1.0 ;Maximum object distance is 0.0
FrustumNear   = 0.0 ;Minimum object distance is -1.0
Position      = (400.0, 300.0, -1.0) ;Note camera Z is -1.0. Visible object range is -1.0 to 0.0
 
[ScoreObject]
Graphic		= ScoreTextGraphic
ParentCamera	= Camera 
UseParentSpace	= false
Position	= (-380, -280, 0.1)  ;note position 0.1 sits in front of the camera
Color		= (255, 255, 255)
 
[ScoreTextGraphic]
Text		= ScoreText
 
[ScoreText]
String		= 10000