ramokz / phantom-camera Goto Github PK
View Code? Open in Web Editor NEW๐ป๐ฅ Control the movement and dynamically tween 2D & 3D cameras. Built for Godot 4. Inspired by Cinemachine.
Home Page: https://phantom-camera.dev/
License: MIT License
๐ป๐ฅ Control the movement and dynamically tween 2D & 3D cameras. Built for Godot 4. Inspired by Cinemachine.
Home Page: https://phantom-camera.dev/
License: MIT License
PhantomCamera3D
is set to follow either nothing or a specific Node
where #40 adds support for specifying the specific Follow logic.
But there are use cases where wanting to just follow along a path is another desired option. While this is possible to do so programmatically, it would be nice to have a built-in system that clamps a PhantomCamera
's movement to a certain path.
Add a new property to the Follow option list from #40 that allows for using either a Path2D
or Path3D
to restrain the PhantomCamera
's position to that path. In addition to this, it ought to also have a property to define what % along the path it should be placed on.
As the PhantomCamera
follows a target Node
follows a target, it will always try to keep itself centred on its target.
There are cases where having the camera not move until a certain amount of movement has been done by the target Node
.
Add a property to PhantomCamera
that adds a movement threshold so that a follow movement won't be triggered until the target exceeds that threshold.
When PhantomCameras
are instantiated, they will currently not trigger a transition. However, this might not be desired in some instances when, for example, instantiating a scene with a PhantomCamera.
Add an Auto Transition property to PhantomCameras
nodes that allow them to trigger a transition if its priority is the highest in the scene when instantiated.
When previewing a PhantomCamera
(based on #24) it would help to see an optional grid view of the camera, such as a 9-grid.
Also supports #29 by being able to see Dead Zone areas in the preview.
Show an optional grid overlay, with a few options, enabled from the PhantomCamera
property list.
Current thinking is a UI overlay, but still pending further thoughts.
Part of #40, having a follow option set to default, or in this case disabled
, when initially adding a Follow Target
will prevent any automatic, and potentially undesired, repositioning.
Add an option to disable any follow logic by default for a PhantomCamera
when setting a Follow Target
node.
Part of #40, to support use cases with very simple follow requirements, Glued Follow
would simply stick to the position of its target with minimal property options.
Add a Glued Follow
option that sets the PhantomCamera
to simply stick to its Follow Target
. The only parameter for this mode is Damping
to ease the positional changes.
When modifying a position or rotation of a PhantomCamera
, in the Editor, you won't see the framing of it until it becomes active.
In order to preview what it sees / frames, you have to manually set its priority to the highest value. This is not only tedious when changing a scene or moving PhantomCameras
around, but can also pose a risk due to forgetting to revert the priority value back to what it should be.
Adding a property button that forces a PhantomCamera
to become active โ in spite of not having the highest priority. This would only be usable in the Editor and disabled during runtime to avoid any unintended behaviour.
Viewfinder should state if it's currently being manually set to active in the editor to prevent confusion with the viewfinder saying one thing, while runtime says something else.
Part of #40, would cover the most typical use case. Contains simple options to offset the target position and damping to provide a bit of flexibility, but without adding the same level of complexity as #78.
Add a Simple Follow
option that has options for Target offset
and Damping
.
When a PhamtomCamera
follows a target's position, that position is based on that target's position.
To offset that position, so that the PhantomCamera
isn't placed inside the target, there's an additional parameter that offsets that position. In practice, all that it does is offsetting the point that the camera is looking at.
The proposal here is to add another property that, on top of the PhantomCamera
's own target offset, allows for setting a forward distance to that offset. Mainly to allow for an easy to define distance parameter to the target.
Add a new property named Distance
that increases the forward vector of the PhantomCamera
.
When PhantomCameras are inactive, they currently stick to their follow / look at logic every frame. This can have some performance implications if many gets added to a scene.
Allow for an option to decide how frequently a PhantomCamera should be updated. Proposed ideas are:
Always
(default), least performant but most accurateNever
, only updating once it becomes activeExponentially
, the more PhantomCameras in the scene, the fewer updatesFixed
, checks based on a user defined interval.Edit:
Descoped to only support Always
and Never
for now.
The repo's Readme file contains a list of example features. Currently, they're just text descriptions, which are not easy to understand without any visual references.
Provide animated examples below each feature sub-header that exemplifies what they mean.
Documentation to cover how the general aspects of the plugin work and how to use.
set_priority()
to change PhantomCamera targetThe current Follow property is effectively a case of โdo or do not followโ.
While this enables a PhantomCamera
to stick to another Node's positional changes, it's also extremely limited in terms of what you can do with it.
Ideally, there should be more flexible options to allow a greater variety of follow logic. This also opens up for other follow behaviour, such as #31.
Add the following Follow behaviours as a dropdown (enum) property option:
Disabled
(Default) #75 โ Disables any follow logic, a Follow Target may still be setSimple Follow
#77 โ Sticks to the target Node
but features offset parameters (how the system currently works), #28 will be affecting thisFramed Follow
#78 โ Similar to Follow Follow
but with many additional options, #28 will be affecting thisGlued Follow
#76 โ Position follows the exact position of the targeted Node
Path Track Follow
#31 โ Follows a given Path2D
or Path3D
Currently, every PhantomCamera
instance's Tweening property has to be entered manually. Meaning if you want to use the same transition, easing and duration for different PhantomCameras
it can be a chore to set up but much more so should changes be required.
The proposal here is to allow for a shared resource that can be reused between different PhantomCameras
.
Add an option to create and save a custom PhantomCameraTween
resource that can be reused between PhantomCameras
.
PhantomCamera3D
is currently able to Look At an individual Node
in a scene.
But there are use cases where keeping multiple Nodes
in view at the same is desired.
Add a new Look At property type to allow multiple Nodes to become the Look At target. The average position would then be the PhantomCamera
's position Look At position in effect.
PhantomCameras
currently follows its Follow target the instant the target's position changes. However, there are many use cases where wanting a slight delay to simulate a more realistic camera operator's movement, or less abrupt changes to the camera, is desired.
Damping the Follow movement would give a bit of weight to the PhantomCamera
's follow logic. Providing a more flexible solution and end experience.
Add a property to PhantomCamera
that dampens the follow movement, effectively adds a small delay to the follow logic.
To provide a simple playable example scene using CharacterBody3D to move round in.
Scene is meant to demonstrate a few different use cases for the plugin, in addition to how it can be applied in practice.
Examples to cover the following interaction / state changes:
All the properties in PhantomCamera classes currently don't have any descriptions for what they do. So the only way to know what each property does is by looking at the wiki documentation, the source code or trial and error.
Add a description to each property that explains what each does.
The current 3D example scene works for simple demonstration purposes.
But it is a bit barebone and could use some further polish.
Add further visual improvements, environment details and gameplay mechanics.
As more PhantomCameras
get added to a scene, it will increasingly become difficult to keep track of all of them without digging through a long hierarchy list.
Issues such as knowing what each PhantomCamera
's priority, Follow/Look At target etc. can quickly become challenging.
A custom Editor UI that lists all PhantomCameras in the active scene.
With some options to see and modify top level properties such as:
In addition to functional behaviour such as:
PhantomCamera
in a scenePhantomCamera
(based on #24)Idea is to support split screen views using multiple PhantomCameraHost
- each attached to separate Cameras (2D or 3D).
When more than 1 PhantomCameraHost
is added to a scene, add a dropdown property option for each PhantomCamera
(to use within the Editor), which allows the user to decide which PhantomCamera
belongs to which PhantomCameraHost
. Each PhantomCameraHost
will then only respond to the changes for the PhantomCameras
that are assigned to it.
PhantomCamera3D
is currently living freely in space as it moves around. While this is fine in many cases, there are also scenarios where there's a desire to make the camera unable to go through colliders in a scene, which would otherwise cause it to go out of bounds and through geometry. Leading to potentially undesired results.
Add a new follow mode parameter to PhantomCamera3D
that functions like a SpringArm
to provide collisions. Essentially working as a base 3rd person follow mode.
Part of #40, a more advance version of #77 with additional properties for more complex framing setup.
Feature options:
Dead Zones
โ meant to keep the camera still until the target exit itDead Zones
areDead Zones
Dead Zone
preview while playing the game โ IMPORTANT Toggle to only show in editor play, and not when exported as a standalone build](https://docs.godotengine.org/en/latest/tutorials/export/feature_tags.html)When instantiating a new PhantomCamera3D, it's set to its default position and rotation. To adjust it, you would either need to set a Follow/Look At property or manually position and rotate it.
The former is not necessarily a desired outcome, and the latter can be a bit tedious to mess around with beyond simple changes.
The proposal here is to set a PhantomCamera3D's position and rotation to the current viewports position and rotation, with the intent to speed up the initial framing process.
Add a button prompt in the property panel for PhantomCamera3D that aligns its positional and rotational value with that of the viewport's.
While you can see where all PhantomCamera3Ds
are positionally located, you can't see what direction they're looking at. Meaning, you would have to either preview the PhantomCamera3D
by making it the active one (cumbersome), or judge it based on its rotational values (super obscure and also cumbersome).
While this isn't game breaking by any stretch, it does mean that accidental rotational values can be applied without any obvious way of spotting it โ particularly when there are many in a scene.
Add a frustum preview that shows the forward direction of a PhantomCamera3D
using either SurfaceTool
or ArrayMesh
.
ImmediateMesh
is also an option should there be a need to change the frustum based on, e.g., any future FOV property options as part of the PhantomCamera
property list. But since it's rendered every frame, it would needlessly reduce the performance while in the Editor.
Currently, the only suggested way to modify a PhantomCamera
's priority, and in turn where the Camera2D
/ Camera3D
is and what it's looking at it, is to call the method set_priority
.
But there are many, if not most, instances where being able to do this via a Timeline, when doing cutscenes or more bespoke animations in general, is a desire approach for using this. While it's possible to adjust this from the timeline, it's a bit overwhelming with the amount of properties to choose from and knowing which to adjust.
The idea here is to explore how to simplify that workflow as much as possible to allow for an equally simple code and timeline approach.
TBD
Part of #62, to avoid any sudden property changes when adding a node to the Look At Target property, a default value set to None
ought to be applied. This can then be overridden with another mode type.
Add a default value of None
to the Look At Mode by default when supplying a valid node to the Look At Target
property.
In the Editor, it can be tricky to know which PhantomCamera
is active, what priority it has, what the second-highest priority is etc. without selecting various PhantomCameras
in the hierarchy.
The proposal is to have a togglable debug UI that will show relevant information when actively working with the plugin.
Add a debug UI that enables will show the following. Should be attached to the PhantomCameraHost
:
PhantomCamera
's namePhantomCamera
's priorityint
valueNote: Priority for visual noise is key. It needs to be easily accessible, but simultaneously show enough to remain useful.
This can be expanded upon should more feature become relevant to this.
As more debug options gets added to the plugin, it can become a frequent thing to go to a PhantomCameraHost
to change debug and other settings.
The proposal here is to add a way to select the PhantomCameraHost
from each PhantomCamera
Add a property prompt to PhantomCameras
that shows and allow for selecting its PhantomCameraHost
.
Similar to #40, there are use cases where having multiple Look At options for a PhantomCamera3D
.
While there are currently three options Don't Look At
, Fixed Look At
and Look at Group
, there are other types that are worth including.
The new options to include are:
Disabled
(Default) #80 โ Disables any rotation logic, a Look At Target may still be setFramed Look At
#81 โ Allows for a variety of options such as offset (#21), damping (#28) and more.Fixed Look At
โ What the current system is using, glues the PhantomCamera3D
to look at the target NodeMimic Look At
#79 โ Copies the rotational value of the targetGroup Free Look At
#38 โ Allows for looking at multiple nodes at once. The mode effectively attempts to keep all of them in view.Part of #62, provides a more advance set of property options for a Look At target.
TBD
To solve errors when adding multiple PhantomCameraHosts to a scene, a temporary solution here is to only support one Host in the scene. This should also be the desired outcome state as multiple cameras ought to, though there might be other use cases, only be for when wanting to do a split view / split screen setup.
Proper Multi PhantomCameraHost support will be added in #26.
Part of #62, adds support for use cases where you would want the Look At
logic to simply mimic the target node's rotational properties.
Add a Look At mode called Mimic
that copies a given Look At target's rotational value.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.