Sinespace Client  2023.2.17543
Client-side scripting for Sinespace
SineSpace.Scripting.Scene.SCameraManager Class Reference
Inheritance diagram for SineSpace.Scripting.Scene.SCameraManager:
ScriptClass< T > ScriptClassWrapper< T >

Public Member Functions

override void Initialise (SScript runtime, object wrapper)
 
void LockCamera (SGameObject owner)
 Takes control of the Camera as long as 'owner' exists in the scene, or until ReleaseCamera() has been called. More...
 
void ReleaseCamera ()
 Relinquishes control of the Camera back to Space More...
 
void SetCameraPositionOrientation (SVector position, SQuaternion orientation)
 Forces the camera to be at position facing orientation for the frame. Needs to be called every frame. More...
 
SRay ScreenCoordinatesToRay (SVector screenCoordinates)
 Returns a ray going from camera through a screen point. More...
 
SVector ScreenCoordinatesToWorld (SVector screenCoordinates)
 Transforms a point from screen space into world space More...
 
SVector WorldCoordinatesToScreen (SVector coordinates)
 Transforms position from world space into screen space. More...
 
void ShakeCamera (float magnitude, float time)
 
void ShakeCamera (float amplitude, float frequency, float time)
 
- Public Member Functions inherited from ScriptClass< T >
void ReportError (string error, bool fatal, UnityEngine.Object target=null)
 
- Public Member Functions inherited from ScriptClassWrapper< T >
override void Initialise (SScript runtime, object wrapper)
 

Properties

bool IsLocked [get]
 Returns true if the Camera is locked More...
 
SGameObject MainCamera [get]
 Note, this property is generally read-only. It's position is driven by internal code. Will return null if main camera is not yet initialized. More...
 
SGameObject ActiveVirtualCamera [get]
 Get the currently active Cinemachine Virtual Camera game object. More...
 
- Properties inherited from ScriptClass< T >
override bool Alive [get]
 Return if the component is alive. More...
 
virtual bool Alive [get]
 
DynValue CachedData [get, set]
 
- Properties inherited from ScriptClassWrapper< T >
_wrap [get]
 

Additional Inherited Members

- Protected Member Functions inherited from ScriptClass< T >
void Initialise (SScript runtime)
 

Member Function Documentation

◆ Initialise()

override void SineSpace.Scripting.Scene.SCameraManager.Initialise ( SScript  runtime,
object  wrapper 
)
virtual

Implements ScriptClass< T >.

◆ LockCamera()

void SineSpace.Scripting.Scene.SCameraManager.LockCamera ( SGameObject  owner)

Takes control of the Camera as long as 'owner' exists in the scene, or until ReleaseCamera() has been called.

Space.Camera.LockCamera()
&ndash; If no camera position/orientation is set upon locking, the camera will lock on the avatar.

◆ ReleaseCamera()

void SineSpace.Scripting.Scene.SCameraManager.ReleaseCamera ( )

Relinquishes control of the Camera back to Space

&ndash; Let's lock the camera for a moment
Space.Camera.LockCamera()
&ndash; Now we can release it
if Space.Camera.IsLocked then
Space.Camera.ReleaseCamera()
Space.Log("Camera released")
end

◆ ScreenCoordinatesToRay()

SRay SineSpace.Scripting.Scene.SCameraManager.ScreenCoordinatesToRay ( SVector  screenCoordinates)

Returns a ray going from camera through a screen point.

Parameters
screenCoordinatesScreen Corrdinates(Use screen size percent range(0,1))
local ray=Space.Camera.ScreenCoordinatesToRay(Vector.New(0.5,0.5,0))
Space.Log("Direction "..ray.Direction.ToString().." Origin "..ray.Origin.ToString())

◆ ScreenCoordinatesToWorld()

SVector SineSpace.Scripting.Scene.SCameraManager.ScreenCoordinatesToWorld ( SVector  screenCoordinates)

Transforms a point from screen space into world space

Parameters
screenCoordinatesScreen Corrdinates(Use screen size percent range(0,1)

–Vector3 the worldspace point created by converting the screen space point at the provided distance z from the camera plane.

Space.Log(Space.Camera.ScreenCoordinatesToWorld(Vector.New(0.5,0.5,0)).ToString())

◆ SetCameraPositionOrientation()

void SineSpace.Scripting.Scene.SCameraManager.SetCameraPositionOrientation ( SVector  position,
SQuaternion  orientation 
)

Forces the camera to be at position facing orientation for the frame. Needs to be called every frame.

Parameters
positionCamera Position
orientationCamera Rotation
local VectorPos = Vector.New(0,0,0)
local VectorRot = Quaternion.Euler(-60,0,0)
Space.Camera.LockCamera()
Space.Camera.SetCameraPositionOrientation (VectorPos,VectorRot)
&ndash; Now the camera is positioned at the global origin and is facing the sky at 60 degrees.

◆ ShakeCamera() [1/2]

void SineSpace.Scripting.Scene.SCameraManager.ShakeCamera ( float  amplitude,
float  frequency,
float  time 
)

◆ ShakeCamera() [2/2]

void SineSpace.Scripting.Scene.SCameraManager.ShakeCamera ( float  magnitude,
float  time 
)

◆ WorldCoordinatesToScreen()

SVector SineSpace.Scripting.Scene.SCameraManager.WorldCoordinatesToScreen ( SVector  coordinates)

Transforms position from world space into screen space.

Parameters
coordinatesWorld space position
local trans=Space.Host.ExecutingObject
Space.Log(Space.Camera.WorldCoordinatesToScreen(trans.WorldPosition).ToString())

Property Documentation

◆ ActiveVirtualCamera

SGameObject SineSpace.Scripting.Scene.SCameraManager.ActiveVirtualCamera
get

Get the currently active Cinemachine Virtual Camera game object.

Space.Log(Space.Camera.ActiveVirtualCamera.Name)
&ndash;print "Virtual PlayerCamera" to the console

< /example>

◆ IsLocked

bool SineSpace.Scripting.Scene.SCameraManager.IsLocked
get

Returns true if the Camera is locked

Space.Camera.LockCamera();
Space.Log(Space.Camera.IsLocked)
&ndash;prints "True" to the console

◆ MainCamera

SGameObject SineSpace.Scripting.Scene.SCameraManager.MainCamera
get

Note, this property is generally read-only. It's position is driven by internal code. Will return null if main camera is not yet initialized.

Space.Log(Space.Camera.MainCamera.Name)
&ndash;print "Main Camera" to the console