Dogan Kirnaz
  • Welcome
  • Setup
    • Quickstart
  • Basics
    • Agent Extensions
    • Audio Extensions
    • Camera Extensions
    • Collision Extensions
    • Coroutine Extensions
    • Encryption Extensions
    • Format Extensions
    • Game Extensions
    • Json Extensions
    • List Extensions
    • Loop Extensions
    • Material Extensions
    • Math Extensions
    • GameObject Extensions
    • Physics Extensions
    • Object Pool Extensions
    • Scene Extensions
    • PlayerPrefs Extensions
  • Support
    • Support
Powered by GitBook
On this page
  1. Basics

Camera Extensions

Shake

This calls the Shake extension method on the main camera, causing it to shake for some seconds with a specified magnitude, creating a dynamic effect often used for impacts or explosive events.

Camera mainCamera = GetComponent<Camera>();

mainCamera.Shake(this, shakeDuration, shakeMagnitude);

Move To

This calls the MoveTo extension method on the main camera, smoothly moving it to the specified target position at a specified speed per second.

Camera mainCamera = GetComponent<Camera>();

mainCamera.MoveTo(targetPosition, moveSpeed);

Rotate To

This calls the RotateTo extension method on the main camera, smoothly rotating it towards the specified target rotation at a specified speed per second.

Camera mainCamera = GetComponent<Camera>();

mainCamera.RotateTo(targetRotation, rotateSpeed);

Follow

This calls the Follow extension method on the main camera, positioning it to follow the specified target (e.g., the player) with a defined offset.

Camera mainCamera = GetComponent<Camera>();

mainCamera.Follow(targetTransform, offset);

Follow Smooth

This calls the FollowSmooth extension method on the main camera, smoothly transitioning to follow the specified target with the given speed and offset, providing a more fluid movement.

Camera mainCamera = GetComponent<Camera>();

mainCamera.FollowSmooth(targetTransform, followSpeed, offset);

Zoom In

This calls the ZoomIn extension method on the main camera, moving it towards the target position while decreasing the orthographic size (zooming in) to the specified zoom level at the defined speed.

Camera mainCamera = GetComponent<Camera>();

mainCamera.ZoomIn(zoomInTarget, zoomInSpeed, zoomLevel);

Zoom Out

This calls the ZoomOut extension method on the main camera, moving it towards the target position while increasing the orthographic size (zooming out) to the specified zoom level at the defined speed.

Camera mainCamera = GetComponent<Camera>();

mainCamera.ZoomOut(zoomOutTarget, zoomOutSpeed, zoomLevel);
PreviousAudio ExtensionsNextCollision Extensions

Last updated 24 days ago