Skip to content

client.controllers.SpringCam.SpringCamera

Mahatma Kollu edited this page Oct 19, 2021 · 2 revisions

Class: SpringCamera

client/controllers/SpringCam.SpringCamera

Manages the creation of a spring-based camera on a player's character

Implements

  • OnInit

Table of contents

Properties

Methods

Properties

janitor

Private janitor: Janitor<void>

Defined in

src/client/controllers/SpringCam.ts:15

Methods

Create

Private Create(): void

Creates the spring camera on the player's head by creating a subject basepart and connecting it's position to a spring which moves to the player's head. Updates the camera on render stepped by calling UpdateCamera with the subject and spring.

Returns

void

Defined in

src/client/controllers/SpringCam.ts:36


Destroy

Private Destroy(): void

Destroys the camera by cleaning up the janitor which has the subject added if the Create() method was ran and unbinds the UpdateSubject function from renderstepped.

Returns

void

Defined in

src/client/controllers/SpringCam.ts:123


onInit

onInit(): void

calls creates the camera by calling Create() when a player's character is loaded in and destroys the camera by calling Destroy() when the player's character is removed.

Returns

void

Implementation of

OnInit.onInit

Defined in

src/client/controllers/SpringCam.ts:20


UpdateCamera

Static Private UpdateCamera(deltaTime, spring, subject): void

Updates the camera by setting the goal of the spring and updating the position of the subject.

Parameters

Name Type Description
deltaTime number -
spring export=<Vector3> a spring which will have it's goal set to the player's head
subject BasePart an invisible basepart which will take on the same position as the spring and is the subject of the player's camera

Returns

void

Defined in

src/client/controllers/SpringCam.ts:80

Clone this wiki locally