I’m building an inventory system that shows items that you can equipt. Hats, body armor, various other clothing items. I’d ideally like to display that in a viewport frame. Is this possible? And if so, how would I do that? I know I’ve rendered a single part in the frame, but I don’t think I ever tried an entire model.
Yes it is possible.
How to do it? Its complicated.
However, there are some tutorials online, maybe search for them.
I made a system for my game’s inventory system, and though it works, the code is a mess, and it took me months to get it working.
So it (at least for me) is rather complicated.
Totally possible. Quite a few games use this.
I’m not super up-to-date on viewport frame updates, but when they first came out there were some limitations with motor6 simulation and animations. I believe those have been fully added now, so it should be pretty simple.
I believe you just need to create a player (for example with the Players service) then parent it to the viewport frame and position the camera’s CFrame to where you want it. (It’s basically just like rendering a part like you mentioned instead of creating a part inside the viewport frame you create a player and set it’s parent to the frame.)
Edit:
JohhnyLegoKing has the solution and something very important: for motor6s to work you need them inside a worldmodel (characters look rigid without the motor6s/animation)
Doing it without a worldmodel works but using one is better because you can use animations to position the character’s limbs in a natural/non-rigid way.
To sum up:
- Create a viewport frame
- Add a camera inside it
- Add a WorldModel inside it
- Create a character with the player’s service
- Parent the character to the world model
- Position the camera
You need to create a WorldModel copy of the character and place that into the ViewportFrame I believe