Coder Social home page Coder Social logo

boyquotes / rts-camera-godot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from amphibian26/rts-camera-godot

0.0 1.0 0.0 3.66 MB

This is a script made in godot 3.1, its a rts style camera with variables to tweak values.

License: MIT License

GDScript 100.00%

rts-camera-godot's Introduction

rts-camera-godot

This script "plug and play", read setup section for detailed information. Since it's my first time making anything in any kind on game engine, if you have any suggestions here is my twitter. Feel free to use or contribute to the code any how you want, just add my attribution and the LICENSE file to your project that's it.

Present Features

  • Movement with 'W','A','S','D'.
  • Movement with cursor when at the edge of the screen, like some RTS games.
  • Panning left and right with 'Q' and 'E'.
  • Tilting up and down with 'R' and 'F'.
  • Zoom in and out with scroll wheel.
  • Point and look while pressing middle mouse and dragging.
  • Majority of the variables are exported to make tweaking, on the go, easy.

Demo

The DEMO.mp4 video in the root folder shows the working of this script, there is also a Example.tscn in the Example folder, to try it out for your self before getting deep into it.

To-do/Upcoming features

  • Add diagonal movement.
  • Add follow camera.
  • Add de-accelaration to tilting in tilt_node.
  • Make zooming smooth
  • Configurable Keys
  • Jump to location
  • Reset to normal orientation
  • (Optional) Picture in picture

Setup

Simply add the Camera.tscn form the Example folder to your scene tree and it will work fine. Note: If you want to change the default camera angle(looking down, left or right), do that changes to the camera node in Camera.tscn before adding it to any scene or project

Setup
This is how the Camera.tscn is setup, it's for reference to the contributors.

  • 'move_node' and 'tilt_node' are Spatial nodes.
  • 'camera' is a Camera node.

Script Description

move_node

It is responsible for movement around the scene and also the panning left and right.

  • area_percent - the percentage of the screen form the edge which will detect the cursor to move the camera.
  • acc - acceleration of the camera while moving over the scene.
  • dec - de-acceleration of the camera while moving over the scene.
  • MAX_SPEED - maximum speed the camera can attain while moving.
  • ang_acc - acceleration of camera while panning left or right.
  • ang_dec - de-acceleration of the camera while panning left or right.
  • MAX_ANG_SPEED - maximum speed the camera can attain while panning left or right.
  • MOUSE_SENSITIVITY - sensitivity of the mouse while pressing the middle mouse button and dragging the camera horizontally.

tilt_node

It is responsible for tilting the camera up or down.

  • ang_acc - acceleration of camera while tilting up or down.
  • MAX_ANG_SPEED - maximum speed the camera can attain while tilting up or down.
  • low - how low the camera can go while tilting(in terms of radian).
  • high - how high the camera can go while tilting(in terms of radian).
  • MOUSE_SENSITIVITY - sensitivity of the mouse while pressing the middle mouse button and dragging the camera vertically.

camera

It is responsible for zooming in and out.

  • zoom_factor - the amount of zoom in each tick of the scroll wheel.
  • max_zoom - limit of zooming out.
  • min_zoom - limit of zooming in.

Acknowledgement

I would really like to thank the people godot discord server who really helped me to clear my doubts and teach me new and alternative methods to approach any problem. And special thanks to these people from the discord server who really help me a lot

rts-camera-godot's People

Contributors

amphibian26 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.