ok so currently im using viewport frames for a avatar changer system, however Im struggling to work out how I can lock the position of the frame so the image always looks like this
no matter where my camera is, any solutions?
ok so currently im using viewport frames for a avatar changer system, however Im struggling to work out how I can lock the position of the frame so the image always looks like this
no matter where my camera is, any solutions?
Do you mean where the hair is in your posted image?
If you mean the GUI position of the viewport showing the hair, you can do something like:
.Position = {0, 20}, {0, -50}
… to be 20 pixels (0, -50) from the bottom, and 20 pixels from the left, meaning bottom left corner.
Or {0.1, 0}, {0.9, 0} to use a scalar (dynamic) position regardless of the parent frame size.
Can you offer a more specific description of what you want to achieve, and/or some images with doodles on them showing good vs bad positions?
Frames have positions, Viewportframes have positions, cameras have positions, GUI objects have positions.
In the image you show which position are you trying to always keep?
When and why do you think the position will change? After all, you already show it being in this position.
What I need is to be able to get a position of the object using my camerra then locking the positions in the frame
I think I know what you mean. So you put the camera for the object as your current camera, but you want to lock it. ViewportFrame Release That article explains what Viewports are and how to lock a camera in a specific place.
local vf = Instance.new(“ViewportFrame”, script.Parent)
vf.Size = UDim2.new(0.5, 0, 0.5, 0)
vf.Position = UDim2.new(0.25, 0, 0.25, 0)
vf.BackgroundColor3 = Color3.new(1, 1, 1)
local part = Instance.new("Part", vf) --replaceable with you part
part.Position = Vector3.new(0, 0, 0)
local camera = Instance.new("Camera", vf)
vf.CurrentCamera = camera
local cameraPosition = Vector3.new(3, 3, 3)
camera.CFrame = CFrame.new(cameraPosition, part.Position)
That script gets the object and puts the camera in the position. The camera position can be adjusted to get the position you want. I hope this helped
so how would I do this from in studio?
You would make a regular script and put it in the frame or gui where the viewport is.