Camera preview differs from game view

Godot Version

4.3

Question

Hi there,

I made a simple script to align an object to a camera…

	public override void _Process(double delta)
	{
		screenPoint.X = GetViewport().GetVisibleRect().Size.X * horizontal;
		screenPoint.Y = GetViewport().GetVisibleRect().Size.Y * vertical;
		testNode.Position = camera.ProjectPosition(screenPoint,depth);
	}

It works great in the game view but when I preview the camera in the editor it seems different.
Nov-19-2024 10-40-13

It kinda seems like the editor preview is off?
Any ideas?

Thanks,
Pete

Looks right to me. Two different viewports, so two different boundaries.

You probably want what the project is set two which is that square in the viewport editor. ProjectSettings[“display/window/size/viewport_hieght”]

ProjectSettings[“display/window/size/viewport_width”]

1 Like

Oh yeah, thanks @pennyloafers.
I got it, I think I might try and align the object based the camera’s frustum rather than the view and see how I go with that.