Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Nickk888SAMP committed Mar 2, 2024
1 parent a1a9872 commit 5f46385
Showing 1 changed file with 30 additions and 41 deletions.
71 changes: 30 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Unity 3D Real Time Strategy Camera Controller for Cinemachine Virtual Camera
# Unity 3D Real Time Strategy/City Builder Camera Controller for Cinemachine Virtual Camera

<img src="/Preview/1.gif" width="250" height="250"><img src="/Preview/2.gif" width="250" height="250"><img src="/Preview/3.gif" width="250" height="250">
<img src="/Preview/4.png" width="750">
<img src="/Preview/1.gif" width="450" height="200"><img src="/Preview/2.gif" width="450" height="200">
<img src="/Preview/5.gif" width="450" height="200"><img src="/Preview/6.png" width="450" height="200">
<img src="/Preview/7.gif" width="450" height="200"><img src="/Preview/8.png" width="450" height="200">
<img src="/Preview/3.gif" width="450" height="200"><img src="/Preview/4.png" width="450" height="200">

This project is a Camera Controller for RTS style games.
This project is a Camera Controller for RTS style games, it'll also fit perfectly into a City Builder!
It works by adding the script to a Gameobject and placing references for the Virtual Camera and the Target itself.
The script controlls the Target and the Virtual Camera.
The script controlls the Target and the Virtual Camera. Use ANY Input System using the Input Provider system.

## Features
* RTS Style Rotation (With Tilt)
Expand All @@ -14,56 +16,43 @@ The script controlls the Target and the Virtual Camera.
* RTS Style Mouse "Drag" Camera Movement
* RTS Style Screen Sides Camera Movement
* RTS Style Position and Transform Lock-On-Target
* Up and Down camera offset.
* Zoom based movement speed.
* Rotate Camera via keys.
* Boundary System confines the camera in a specific area.
* Invert mouse input.
* Limits and smoothing.
* Works the same with low and high Framerates.
* It's smooth, it's lightweight and it just works.
* Timescale independent, you can "pause" the game and still use the controller.
* An Input Provider System that lets you connect ANY Input System with the controller.
* Automatic Ground detection allowing Camera to move up and down depending on the ground.
* UI Controller (Compas, Zoom Slider, Drag Images, Rotate Image)
* Exposed Script as a Singleton to get access to controller from every script.
* Works exceptionally well with Gamepads when used with the new Input System.
* Optional UI Controller (Compas, Zoom Slider, Drag Images, Rotate Image)

## Requirements
* Cinemachine
* Old Input System or Both

## How To Use
* Make sure you have installed the "Cinemachine" package from the Package Manager.
* If you are using the New Input System, change the "Active Input Handling" to "Both" inside "Project Settings" > "Player" > "Other Settings"
* If any, delete the default Main Camera from the Scene.
* Place the "RTSCameraController" (located in the "Prefabs" directory) to your Scene.
* Have Fun!

Default Settings:

WASD or Middle Mouse Button - Camera Movement

Right Mouse Button - Rotation
Right Mouse Button or Q or E - Rotation

Mouse Scroll Wheel - Zoom-In/Zoom-Out

## Properties (Get & Set)
```csharp
RTSCameraTargetController.Instance.VirtualCamera;
RTSCameraTargetController.Instance.GroundLayer;
RTSCameraTargetController.Instance.CameraTarget;
RTSCameraTargetController.Instance.IndependentTimeScale;
RTSCameraTargetController.Instance.IndependentCinemachineBrainTimeScale;
RTSCameraTargetController.Instance.AllowRotate;
RTSCameraTargetController.Instance.AllowTiltRotate;
RTSCameraTargetController.Instance.AllowZoom;
RTSCameraTargetController.Instance.AllowDragMove;
RTSCameraTargetController.Instance.AllowTiltRotate;
RTSCameraTargetController.Instance.AllowKeysMove;
RTSCameraTargetController.Instance.AllowScreenSideMove;
RTSCameraTargetController.Instance.CameraTiltMinMax;
RTSCameraTargetController.Instance.CameraMouseSpeed;
RTSCameraTargetController.Instance.CameraRotateSpeed;
RTSCameraTargetController.Instance.CameraKeysSpeed;
RTSCameraTargetController.Instance.CameraZoomSpeed;
RTSCameraTargetController.Instance.CameraMoveDeadZone;
RTSCameraTargetController.Instance.ScreenSidesZoneSize;
RTSCameraTargetController.Instance.TargetLockSpeed;
RTSCameraTargetController.Instance.CameraTargetGroundHeightCheckSmoothTime;
RTSCameraTargetController.Instance.CameraZoomSmoothTime;
RTSCameraTargetController.Instance.CameraZoomMinMax;
RTSCameraTargetController.Instance.CameraZoomSlider;
RTSCameraTargetController.Instance.MouseDragCanvasGameObject;
RTSCameraTargetController.Instance.MouseDragStartPoint;
RTSCameraTargetController.Instance.MouseDragEndPoint;
RTSCameraTargetController.Instance.RotateCameraCanvasGameObject;
RTSCameraTargetController.Instance.CompasUiImageGameObject;
```
R or F - Height Change

## Create your own input provider script
Just create a new Script and inherit from the ```IRTSCInputProvider``` interface and let your editor automatically populate with all the methods from the ```IRTSCInputProvider```.
Return the values (Bool, float or Vector2) to the specific Methods.
Place the script alongside the Controller script and that's it.
Just make sure there's only one Input Provider placed as a component.
You can use the premade Input Providers as a guide.

0 comments on commit 5f46385

Please sign in to comment.