Petey
November 18, 2024, 11:51pm
1
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.
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
Petey
November 19, 2024, 5:48am
3
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.
system
Closed
December 19, 2024, 5:49am
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.