wiki.sine.space | sinespace

Difference between revisions of "Scripting/SCamera"

From wiki.sine.space
Jump to: navigation, search
Line 16: Line 16:
 
local Object = Space.Scene.Find("Camera")<br>
 
local Object = Space.Scene.Find("Camera")<br>
 
Space.Log(Object.Camera.Enabled);<br>
 
Space.Log(Object.Camera.Enabled);<br>
''--print true.''
+
''--print true.''|6=<pre>--clicking this object will Enable/Disable it's Camera component
 +
thisGameObject = Space.Host.ExecutingObject
 +
component = thisGameObject.Camera
 +
 
 +
 
 +
OnClick = function()
 +
component.Enabled =  not component.Enabled
 +
end
 +
 
 +
 
 +
thisGameObject.AddClickable()
 +
thisGameObject.Clickable.OnClick(OnClick)</pre>
 
}}
 
}}
  

Revision as of 03:41, 13 October 2021

Members

TakePhoto

void TakePhoto ()

Triggers the Photo window in the UI, with the output of this camera. Perfect for photo booths.

local Object = Space.Scene.Find("Camera")
Object.Camera.TakePhoto()


TakeSnapshot

SResource TakeSnapshot ()

Captures a texture from the camera, and saves it in a SResource

local Object = Space.Scene.Find("Camera")
Object.Camera.TakeSnapshot().Name;



Properties

Enabled

bool Enabled { get; set; }

Is this camera enabled?

local Object = Space.Scene.Find("Camera")

Space.Log(Object.Camera.Enabled);

--print true.


--clicking this object will Enable/Disable it's Camera component
thisGameObject = Space.Host.ExecutingObject
component = thisGameObject.Camera


OnClick = function()
component.Enabled =  not component.Enabled
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)

FarClip

float FarClip { get; set; }

How far is an object from the camera plane before it is not rendered?

local Object = Space.Scene.Find("Camera")
Space.Log(Object.Camera.FarClip)


FieldOfView

float FieldOfView { get; set; }

The field of view of the camera, in typical scenarios, Sinespace uses a value of 52; however Unity will default to 60.

local Object = Space.Scene.Find("Camera")
Space.Log(Object.Camera.FieldOfView)


HDR

bool HDR { get; set; }

Can this camera write HDR values? (i.e. values brighter than 1.0)

local Object = Space.Scene.Find("Camera")

Space.Log(Object.Camera.HDR)

--print true.


NearClip

float NearClip { get; set; }

How close can an object be to the camera plane before it is not rendered?

local Object = Space.Scene.Find("Camera")
Space.Log(Object.Camera.NearClip)


Orthographic

bool Orthographic { get; set; }

Does this camera render without perspective?

local Object = Space.Scene.Find("Camera")
Space.Log(Object.Camera.Orthographic)


OrthographicSize

float OrthographicSize { get; set; }

The width of the camera when in Orthographic mode. Height will be adjusted based on aspect ratio of the Render Texture

local Object = Space.Scene.Find("Camera")
Space.Log(Object.Camera.OrthographicSize)


PixelHeight

int PixelHeight { get; }

The height of this Camera's texture in pixels

local Object = Space.Scene.Find("Camera")
Space.Log(Object.Camera.PixelHeight)


PixelWidth

int PixelWidth { get; }

The width of this Camera's texture, in pixels

local Object = Space.Scene.Find("Camera")
Space.Log(Object.Camera.PixelWidth)


UseOcclusionCulling

bool UseOcclusionCulling { get; set;}

Is Occlusion Culling enabled on this camera?

local Object = Space.Scene.Find("Camera")

Space.Log(Object.Camera.UseOcclusionCulling)

--print true.


Velocity

SVector Velocity { get; }

World space speed of this camera, typically used for motion blur.

local Object = Space.Scene.Find("Camera")

local VectorData = Object.Camera.Velocity;

Space.Log(VectorData)