+1 vote

So, I'm making a sniper rifle in my game, and I wanna do a picture on picture scope for my rifle (This scope renders the world in a viewport). Everything is fine and it works, but, when I run my game the viewport displays in a same spot.
Is something strange because is like my scope camera isn't from the player kinematic body.

Here's a video about what happens to me.
https://youtu.be/boNC8NrbvOg

I hope you can help me

(Srry for the bad fps)

Godot version Godot 3.5
in Engine by (21 points)
edited by

Have you set the update more to always on the viewport .

Yes, I did that and the problem is still there. I think that the problem is in the node tree.

1 Answer

+1 vote
Best answer

I don't have access to try a prototype right now, but I believe the problem is that the viewport object does not inherit from the spatial object so it does not actually track it's position. This means that when your player object moves, the ScopeCamera object stays where it was. So, if you put a Camera as a child of the Viewport it's location will not get updated.

One solution is to force updates to your ScopeCamera location using a script or using a RemoteTransform object. The RemoteTransform is super easy to use - just add that to your tree where you wan the camera to look from, then configure it to update the ScopeCamera object. That will take care of position and rotation etc

by (658 points)
selected by

Dude, I love u. THANK YOU SO MUCH MY DUDE

Cool! I hope that works out

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 Frequently asked questions and 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 [email protected] with your username.