Coder Social home page Coder Social logo

goutte / godot-trackball-camera Goto Github PK

View Code? Open in Web Editor NEW
47.0 5.0 3.0 84 KB

A Godot addon that adds a trackball camera node without gimbal lock.

License: MIT License

GDScript 100.00%
godot addon camera trackball quaternions plugin godot-engine gdscript godot-addon godot-addons

godot-trackball-camera's Introduction

Trackball Camera for Godot

MIT Release FeedStarvingDev

A Godot 4.x addon that adds a TrackballCamera node without gimbal lock.

The TrackballCamera responds to input from mouse, keyboard, joystick and touch, in order to rotate around its parent node while facing it.

A version for Godot 3.x is available as well. A version for Godot 2.x is available as well.

Features

  • stays around its parent node, even if the latter moves
  • no gimbal lock (quaternions ๐ŸŒŸ)
  • camera inertia for a smoother experience (can be disabled)
  • horizon can be stable or free
  • the parent node does not have to be centered in the camera's view
  • analog camera control with joystick, courtesy of @marcello505 (in #4)
  • a bunch of parameters to configure everything as you want it
  • one-click creation of camera actions (jams!)

Install

The installation is as usual, through the Assets Library. You can also simply copy the files of this project into yours, it should work.

Then, enable the plugin in Scene > Project Settings > Plugins.

Usage

Make the TrackballCamera a child of the Node3D to trackball around. Make sure your camera initially faces said node, and is at a proper distance from it. The initial position of your camera matters. The node does not need to be in the center of the camera's view.

You can also use this camera to look around you if you place it atop its parent node, spatially. It's going to rotate around itself, and that amounts to looking around. You'll probably want to set mouse_invert and keyboard_invert to true in that case.

Todo

  • Test if touch works on android and html5, try SCREEN_DRAG otherwise. (see #6)

Feedback and contributions are welcome!

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.