+1 vote

When I call getviewportposition() I expect to get the position of the node in the viewport. That happens when the smoothing camera is off, but when it's on I get the final position of the node.

Normally this is not important, but I have a node2d that's drawing (_draw()) directly to the screen position (like a viewport size texture that needs to know exactly where the different elements in the screen are).

So, is there any way to get the real position of the sprites when the screen is moving smoothly or the only way is to set smoothing off and code my own camera 2D smoothing code?

in Engine by (38 points)

2 Answers

+2 votes
Best answer

Sorry for the delay: the only way to acomplish the task was using the get_camera_screen_center() function.

by (38 points)
0 votes

Use get_camera_position() on the active camera.

by (14 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.