Object highlighter odd behavior

I’m trying to recreate an object highlighter using ViewportFrames and neon parts.

Basically, I made a neon part in workspace and made a replica of that part with different colors inside a ViewportFrame the size of the screen. I set the CurrentCamera to workspace.CurrentCamera. This works fine in studio, but when in game the ViewportFrame changes position (much like a billboard gui) when the camera is moving.

Studio:
image

In-Game:
https://gyazo.com/097db63d89ae74ad4fb1ebcf2c88a18d

I’m not sure what if this is normal ViewportFrame behavior and how to go about this.

Thanks,
DevJamal

3 Likes

This is normal behavior as far as i can tell, if you are setting the viewport frame’s camera to the camera inside the workspace, the viewport frame is going to be following that camera, not literally (as in the 2d frame is moving) but the camera positions in the both the rendered worlds are going to be the same (if that makes sense). Do you want it not to move?, This seems like a Object Highlighter to me!

Well, i want the 2d rendered object to stay “anchored” to the physical part (not literally) to provide a glowing effect on the edges of the model.

Are the parts in the exact same position? (the one in the viewport frame and the one in the 3d world) , if not this very well could be a side effect of how Viewport frames render neon parts. Also consider the size of the viewport frame, if it is not covering the entire screen that could be the/a problem

Does the viewportframe size position account for the topbar? Try setting IgnoreGuiInset to true for the parent screengui.

4 Likes

Yes they are complete duplicates with the same properties and the size of the ViewportFrame is {1,0,1,0}. Which leads me to believe there is most likely a way of fixing this only through scripts

Does it account for the top bar as @harule said aswell?

Oops, I meant to say position, the topbar shifts any gui down by 36 pixels, hence the black circle is always below the neon part in game only.

Actually it did fix it! Thanks so much!

1 Like