I am attempting to make my viewport frame show a pet but for some reason the pet inside is completely black even though I used the same method for the one in the list and it works fine.
here is the code that creates the camera:
local IconCamera = Instance.new("Camera")
IconCamera.Parent = PetInventoryUI.Main.PetIcon.PetViewport
PetInventoryUI.Main.PetIcon.PetViewport.CurrentCamera = IconCamera
here is the code that adds the pet
petModel = ReplicatedStorage.Pets[petData.petType]:Clone()
petModel.Parent = PetInventoryUI.Main.PetIcon.PetViewport
petModel.CFrame = IconCamera.CFrame + (IconCamera.CFrame.LookVector * 3)
petModel.CFrame = PetModel.CFrame * CFrame.Angles(0, math.rad(115), 0)
1 Like
7z99
(cody)
November 11, 2020, 11:34pm
#2
Are you ever setting the camera’s CameraType to Enum.CameraType.Scriptable
? You should do that right after creating the camera.
DumbSkid
(Stephen)
November 12, 2020, 1:25am
#3
This is not necessary for ViewportFrame Cameras.
2 Likes
jsourj
(sour)
November 12, 2020, 1:50am
#4
Check the light color, light direction and image color
BlixBit
(BlixBit)
November 12, 2020, 1:54am
#5
Did you actually instance or make a viewport frame? Because I’m pretty sure viewport frames and standard guis are two separate classes.
Just for testing purposes try instancing a viewportFrame and see if it works.
Like this:
local viewportFrame = Instance.new("ViewportFrame", parent) -- put what the viewportFrame is gonna be instanced into
Fool around with the size, BackgroundTransparency, Position and other properties. And try defining the IconCamera’s CFrame.