All pages
Powered by GitBook
1 of 1

Loading...

SCameraManager

Index

Functions Index

Function Name

Properties Index

Property

Properties

IsLocked

bool IsLocked get

Is the Camera locked?

MainCamera

MainCamera get

Note, this property is generally read-only. It's position is driven by internal code.

ActiveVirtualCamera

ActiveVirtualCamera get

The currently active Cinemachine Virtual Camera game object.

Functions

LockCamera

void LockCamera ()

Calling this function stops the Camera from being controlled by the viewer, and allows us to control it until is called.

ReleaseCamera

void ReleaseCamera ()

Calling this function reverses the call and returns control of the Camera to the viewer.

SetCameraPositionOrientation

void SetCameraPositionOrientation ( position, orientation)

Sets the Camera's position and rotation. This function requires

Parameter
Type
Description

ScreenCoordinatesToRay

ScreenCoordinatesToRay ( screenCoordinates)

Returns a ray going from camera through a screen point.

Parameter
Type
Description

ScreenCoordinatesToWorld

ScreenCoordinatesToWorld (screenCoordinates)

Transforms a point from screen space into world space.

Parameter
Type
Description

WorldCoordinatesToScreen

WorldCoordinatesToScreen ( coordinates)

Function Description

Parameter
Type
Description

ShakeCamera

void ShakeCamera (float magnitude, float time) void ShakeCamera (float amplitude, float frequency, float time)

Function Description

Parameter
Type
Description

void LockCamera (SGameObject owner)

void ReleaseCamera ()

void SetCameraPositionOrientation (SVector position, SQuaternion orientation)

SRay ScreenCoordinatesToRay (SVector screenCoordinates)

SVector ScreenCoordinatesToWorld (SVector screenCoordinates)

SVector WorldCoordinatesToScreen (SVector coordinates)

void ShakeCamera (float magnitude, float time) void ShakeCamera (float amplitude, float frequency, float time)

bool IsLocked get

SGameObject MainCamera get

SGameObject ActiveVirtualCamera get

position

SVector

The World Postion of the camera GameObject.

orientation

SQuaternion

The World Rotation of the camera GameObject.

SGameObject
SGameObject
ReleaseCamera()
LockCamera()
SVector
SQuaternion
the camera to be locked.
SRay
SVector
SVector
SVector
SVector
SVector
isCameraLocked = Space.Camera.IsLocked
mainCamera = Space.Camera.MainCamera
currentCamera = Space.Camera.ActiveVirtualCamera
Space.Camera.LockCamera()
Space.Camera.ReleaseCamera()
Space.Camera.SetCameraPositionOrientation (Vector.New(0,0,0),Quaternion.Euler(-60,0,0));
cameraRay = Space.Camera.ScreenCoordinatesToRay (Vector.New(0,50,0))
 --this script will make this object jump to wherever you right click
--(Example: moving objects with right click )

thisGameObject = Space.Host.ExecutingObject


OnUpdate = function()
  if Space.Input.GetMouseDown(1) then
   clickRay = Space.Camera.ScreenCoordinatesToRay(Space.Input.MousePosition)
  rayCastHit = Space.Physics.RayCastSingle(clickRay.Origin, clickRay.Direction, 50.0)
  thisGameObject.WorldPosition = rayCastHit.Position
  end
end

thisGameObject.SubscribeToEvents()
thisGameObject.OnUpdate(OnUpdate) 
obj = Space.Host.ExecutingObject;
Space.Log(Space.Camera.ScreenCoordinatesToWorld(Vector.New(0.5,0.5,0)).ToString());

-- Print 3 worldspace vectors created by screen space point to the console.
local trans = Space.Host.ExecutingObject;
Space.Log(Space.Camera.WorldCoordinatesToScreen(trans.WorldPosition).ToString());

-- Print the position created by world space point to the console.
Space.Camera.ShakeCamera(1, 1.0)
--or
Space.Camera.ShakeCamera(2, 1, 1.0)