From 5f463855da63d07e932b094f12b3aa9ba0d2ab7f Mon Sep 17 00:00:00 2001 From: Nickk888 <35627647+Nickk888SAMP@users.noreply.github.com> Date: Sat, 2 Mar 2024 01:23:57 +0100 Subject: [PATCH] Update README.md --- README.md | 71 +++++++++++++++++++++++-------------------------------- 1 file changed, 30 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index d78cc6de..75644526 100644 --- a/README.md +++ b/README.md @@ -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 - - + + + + -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) @@ -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.