So, I want to make a custom inventory, but for that, I need a 2D representation of the object. How do I do this? I tried to drag the model into the ScreenGui, but it doesn't really do anything.
You would use Viewport Frames for that, those are frames that can have 3D objects rendered inside of them.
First of all, you need to create object that you won't to be rendered, let's say for example just create a part in this example, to replicate the part, you must parent it to the ViewportFrame
you want it to be inside of. So example image of current explorer here.
Now the part should be visible in the frame, if the part is located weirdly or not visible at all (Because not in range of the viewport), all you have to do is move it with your Move
or Rotate
tools, you will see it move in the frame too! If you want to have model in the frame, simply put a model inside of the frame and it will render the frame!
If the part is still not visible or you don't want to move it, you can use Camera.CFrame
, it's CFrame of location that the frame will render, for that, you need to create new Camera
Instance and parent it to the frame. Make sure that ViewportFrame
's CurrentCamera
= the newly created camera and Camera.CameraSubject
= the part you want to render. then you would simply do something like
Camera.CFrame = CFrame.new(Vector3.new(0, 10, 0), Part.Position)
That will look on the part from top (10 studs above it).
You should read this article, it explains how the frames work and will help you understand it.