So I have been trying to create a 3D document inspection/read system and it all seems to work pretty well until you start to move your camera or character around.
A solution I have tried is using a ViewportFrame, which works pretty well, but the rendered decal is way too low quality.
My current methods for moving the object around is with CFrame and TweenService. If I wasn’t using tweening I could easily fix this issue, but I am using tweening as a little animation for the object, which causes issues as seen below.
Does anyone know a solution or an alternative solution to this problem?
Help will be greatly appreciated as always!
local function InsertObject(ObjectToView)
CurrentObject = ObjectToView:Clone()
CurrentObject.CanCollide = false
CurrentObject.CFrame = PlayerCamera.CFrame * ObjectToView.ViewAttachment.CFrame * ViewStartCFrame
CurrentObject.Parent = PlayerCamera
end
Main pickup/putdown functions with tweening
local function Open(SelectedPaper)
if not Toggling then
Toggling = true
print("Opening paper...")
CloseButton.Visible = true
CloseButton.Modal = true
BackgroundBlur.Enabled = true
Mouse.Icon = ""
InsertObject(SelectedPaper)
local ObjectTween = TweenService:Create(CurrentObject, PaperTweenInfo, {CFrame = PlayerCamera.CFrame * CurrentObject.ViewAttachment.CFrame})
local BlurTween = TweenService:Create(BackgroundBlur, PaperTweenInfo, {FarIntensity = 1})
ObjectTween:Play()
BlurTween:Play()
OpenSound:Play()
wait(TweenTime)
Toggling = false
end
end
local function Close()
if CurrentObject and not Toggling then
Toggling = true
print("Closing paper...")
CloseButton.Modal = false
CloseButton.Visible = false
Mouse.Icon = OriginalMouseIcon
local ObjectTween = TweenService:Create(CurrentObject, PaperTweenInfo, {CFrame = PlayerCamera.CFrame * CurrentObject.ViewAttachment.CFrame * ViewEndCFrame})
local BlurTween = TweenService:Create(BackgroundBlur, PaperTweenInfo, {FarIntensity = 0})
ObjectTween:Play()
BlurTween:Play()
wait(TweenTime)
BackgroundBlur.Enabled = false
if CurrentObject then
CurrentObject:Destroy()
CurrentObject = nil
end
Toggling = false
end
end