Position tools for viewports

I have tools and I want to create a custom backpack. I say Tools cause I’m using the tool instance, but they aren’t all tools like you might think. As in, some items are blocks, weapons, other random things. I just use the tool instance so it’s easily welded to their hand, position wise etc. However I am having trouble setting up the viewport for them. As each tool has a different shape/size.

The viewports should show an axe in 1, pickaxe in 2 and stone in 4. However, they all look way off

-- Set camera
Camera.CFrame = CFrame.new(ViewportModel.Handle.Position + Vector3.new(0, 0, 4))

I’m trying to achieve something like this

I’m assuming they used tools because of the way equipping items in the game is, each item equips like it’s a tool.

Assuming you are storing the tools in ServerStorage and cloning them into the the viewport. You can position your CurrentCamera to the tool camera angle you want and print out the CFrame for it and set that as the viewport’s camera CFrame. This way you can actually get the camera angle you actually want instead of doing it trial and error.

I’m not entirely sure what you mean here?

Try adjusting the orientation before placing them inside the ViewportFrame.

I can’t they are tools
30 chars

why cant you? its not like you cant rotate the tool in studio

Rotating it in studio doesn’t affect it’s distance from the camera in viewport

try changing the Handle Orientation once its positioned

Handle.CFrame = CFrame.new(Handle.Position,camera.Position

multiply it to an angle to get your preferred one

You can use :GetBoundingBox() of a model to get the size of the model and use that to properly adjust the camera CFrame accordingly.

I’m using tools, not models
30 characters

For interfaces you should ideally use ‘mock’ objects, which would be models. Otherwise you’re going to have a bunch of tools sitting within your interface.

Then I’d have to have multiple objects stored in rep storage of the exact same thing? ie, a tool and a model

You would store the mock object inside of the ReplicatedStorage and store the actual tool inside of ServerStorage. Yes, you would have one that’s the actual tool and one that’s just a model used for the viewport. The one is that being used for the viewport wouldn’t be functional though just a model of the physical appearance of it.

1 Like