Godot Version
4.2
Question
Try to I started googling my problem. I kind of found a solution by copying it to ImageTexture.
public static Texture GetPhoto(in Vector2 cameraPosition, in Vector2 zoom = default)
{
var camera = MainAPINPCPhoto.GetCamera2D();
var newZoom = zoom;
if (newZoom == default)
newZoom = new Vector2(45, 30);
camera.Zoom = newZoom;
camera.Position = cameraPosition;
var texture = MainAPINPCPhoto.GetTexture() as Texture2D;
var image = texture.GetImage();
var imageTexture = ImageTexture.CreateFromImage(image);
return imageTexture;
}
However, Image corresponds to the previous point. Each time I change the position of the camera, the texture itself corresponds to a point on the map, but the Image I get from the same texture corresponds to the previous point.
How to get a non-changing ViewportTexture? as many details as possible