[!IMPORTANT]
Both Godot 4.2 and 4.3 are supported, however the enhancements here will only work for Godot 4.3 dev6 or later.
[!IMPORTANT]
The changes only affect 2D scenes.
3D phyics interpolation are not yet supported in Godot and will be added in a future release.
What is this?
This change applies the newly added physics interpolation that was included in Godot 4.3 dev 6 release.
The changes in this PR allows a PCam2D to support having a follow target of either a PhysicsBody2D-based or a non-PhysicsBody2D-based node, where the Camera2D will then automatically adjust its interpolation mode to match. Resulting in a jitter-free movement.
Before this, the user had to make use of either the smoothing-addon or implement their own solution to interpolate visuals as mentioned in the documentation.
For Godot 4.2
This release will still be compatible with Godot 4.2. It does a few checks to confirm the version and disables the added functionality while retaining existing behaviour. So nothing should be worse or better from this change.
[!NOTE]
It will encourage to upgrade to Godot 4.3 if one attempts to select a PhysicsBody2D as a follow target or follow targets (Group Follow).
For Godot 4.3
Project Settings
Enable the Physics Interpolation, inside physics/common/physics_interpolation
Advanced Settings will likely need to be enabled to see it.
### PhantomCameraHost
~~To enable the newly added physics interpolation, uncomment the following two lines inside `PhantomCameraHost.gd` on line `201` and `206`.~~
```gdscript
camera_2d.physics_interpolation_mode = Node.PHYSICS_INTERPOLATION_MODE_ON
```
```gdscript
camera_2d.physics_interpolation_mode = Node.PHYSICS_INTERPOLATION_MODE_OFF
```
Do no uncomment those lines in Godot 4.2 as that will likely crash the editor.
Known Issues
[!NOTE]
All known issues have now been addressed.
Switching to a PCam2D that has a PhysicsBody2Dfollow target from another PCam2D that either has no follow target or a non-PhysicsBody2Dfollow target will cause a sudden camera flickering on the first few frames. The tween still triggers, but the effect is very noticeable and not good enough for release.
This appears to be due to setting the Camera2D's physics_interpolation_mode to Node.PHYSICS_INTERPOLATION_MODE_ON from having previously being Node.PHYSICS_INTERPOLATION_MODE_OFF.
Notes
This issue is only appearing when enabling it after it has been disabled, and not the other way around.
This appears to occur independently of the addon and occurs in simple projects too
What is this?
This change applies the newly added physics interpolation that was included in Godot 4.3 dev 6 release. The changes in this PR allows a
PCam2D
to support having afollow target
of either aPhysicsBody2D
-based or a non-PhysicsBody2D
-based node, where theCamera2D
will then automatically adjust its interpolation mode to match. Resulting in a jitter-free movement.Before this, the user had to make use of either the smoothing-addon or implement their own solution to interpolate visuals as mentioned in the documentation.
For Godot 4.2
This release will still be compatible with Godot 4.2. It does a few checks to confirm the version and disables the added functionality while retaining existing behaviour. So nothing should be worse or better from this change.
For Godot 4.3
Project Settings
Physics Interpolation
, insidephysics/common/physics_interpolation
Advanced Settings
will likely need to be enabled to see it.Known Issues
Switching to aPCam2D
that has aPhysicsBody2D
follow target
from anotherPCam2D
that either has nofollow target
or a non-PhysicsBody2D
follow target
will cause a sudden camera flickering on the first few frames. The tween still triggers, but the effect is very noticeable and not good enough for release.This appears to be due to setting theCamera2D
'sphysics_interpolation_mode
toNode.PHYSICS_INTERPOLATION_MODE_ON
from having previously beingNode.PHYSICS_INTERPOLATION_MODE_OFF
.Notes
This issue is only appearing when enabling it after it has been disabled, and not the other way around.This appears to occur independently of the addon and occurs in simple projects too