Closed mechPenSketch closed 1 month ago
I would prefer not to change the follow target behaviour to trigger a tween when setting a follow_target
, as it will start getting a bit murky with how a tween works behind the scenes.
In your case, if you want to reuse the properties of a PCam
, then you can save the PCam
in question as its own scene and add instances of that to the main scene. Where you then apply the general properties, like zoom
, in that separate PCam
scene, which will update each instance in the main scene — kinda like a prefab or component.
To get a tweening behaviour working like you described, and to save nodes in the scene, I would use two PCams
rather than one for each character. The first being what you would use by default that follows the player. The second one effectively being on stand-by and only gets attached to a given target once needed and then given the highest priority. The initial PCam
then becomes the one on stand-by, and you can then just repeat that process and juggle between the two like that. Which should give you the desired tween effect.
Your proposal could be an additional target setter function if anything, but personally, I want to try and only add features that add new functionality to keep the codebase as light as possible — the exception is when it greatly simplified an otherwise very complicated workaround such as set_cull_mask_value()
. Think the added codebase complexity cost for this is higher than the value of the problem it would solve.
I guessed as much that there's supposed to be one phantom camera per character. I've gone with your counter-suggestion instead.
Project Type
2D (Might apply to 3D too)
Feature Description
When
set_follow_target(value: Node2D)
is called, I want the phantom camera to move to the new target, rather than instantly set its position to it.Use Cases
In my game I have four characters. Only one of them is controllable, so the character follows him. However, I can change who to control at any time. Upon doing so, the phantom camera would pan towards the next player, rather than immediately jumping towards it.
By right, the work-around for this issue is to set up a phantom camera for each character. However, since the cameras would have the same custom properties (such as
zoom
) plus their roles are similar, I thought I could reduce node count.(Optional) Proposed Solution
On
set_follow_target(value: Node2D)
, before setting "follow_target = value", set up a tween to transition the position from the old follow target to the new.If there's no objections, I'll make a new PR for this.