What do you want to achieve? be able to interact with objects in a viewportframe like be able to click it then it will show you what is it
What is the issue? I have no idea on how to do such things.
What solutions have you tried so far? i tried adding click detectors on the part and surface gui buttons
All i want to know is how to be able to click it on the viewportframe.
Put a 2D button on top the Viewport.
Also, please be aware that the DevForum members will not make an entire script for you, unless it’s for your better understanding.
Lets say I have a minimap using viewportframes that follows my player. Are you saying that I add a 2d button on the middle of the minimap?
Yes, that is one way of doing it.
Any other ways? Because the player is not the only thing i want to interact with
Well, I don’t think so, not without super complicated code (math and such).
ViewportFrame is a UI that renders a camera, and it’s
not a second interactable
workspace. UI is your only way for this to work.
You other method would be to convert the objects in the frame to 2D relative position, and then get the player mouse click event and mouse relative position.
if i understand correctly, You want to be able click/hover over objects in viewportframes, right? One way you can do that is use the method i described here: (there is a place file at the bottom)
Worldmodel officially released! so there is probably no need for the method described here anymore!
i recently made a relatively “quick” set of posts here: Mouse.Hit Inside ViewPort Frames? about raycasting and finding Mouse.Hit/Target in viewport frames and i thought i’d make a post here to go more in depth or provide more info on how to actucally do it and while i am at it some more functionailty. However, keep in mind i won’t go too in depth into how the specific math works on a…
Or alternatively this module Onogork made:
Btw, at some point this will become easier when worldmodels are released, which will allow us to natively ray cast in viewportframes. (supposedly)