My game has a tilt system where the character tilts in the direction it walks, and my game also has character viewport display thing where it shows the player’s character whenever their inventory is open, it all works fine but the problem is that the player’s display viewport is not mirrored, which makes it look weird when you walk.
I basically just want to mirror the character in the viewport.
Here is my current code that runs every frame:
for _, part in pairs(self.ViewportCharacter:GetDescendants()) do
if part:IsA("BasePart") then
local realPart = nil
for _, possiblePart in pairs(self.Character:GetDescendants()) do
if possiblePart.Name == part.Name and possiblePart.Parent.Name == part.Parent.Name then
realPart = possiblePart
end
end
if realPart and part.Name ~= "HumanoidRootPart" then
local relativeCFrame = realPart.CFrame:ToObjectSpace(self.Character.HumanoidRootPart.CFrame):Inverse()
part.CFrame = self.ViewportCharacter.HumanoidRootPart.CFrame * relativeCFrame
end
end
end