Graphictoria-Legacy/renders/v1/infra/scripts/headshot.txt

99 lines
4.7 KiB
Plaintext

local UserId = %ITEMID%
local Pose = %POSE%
local Player = game:GetService("Players"):CreateLocalPlayer(0)
Player.CharacterAppearance = "http://api.gtoria.net/user/getCharacter.php?key=D869593BF742A42F79915993EF1DB&mode=ch&sid=1&uid=" .. UserId
Player:LoadCharacter(false)
local Character = Player.Character
-- Walking
if Pose == 1 then
local walk = math.sin(.73*9)
Character.Torso['Left Shoulder'].C0=CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
Character.Torso['Left Shoulder'].C1=CFrame.new(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)*CFrame.Angles(0,0,walk)
Character.Torso['Right Shoulder'].C0=CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
Character.Torso['Right Shoulder'].C1=CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)*CFrame.Angles(0,0,walk)
Character.Torso['Left Hip'].C0=CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
Character.Torso['Left Hip'].C1=CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)*CFrame.Angles(0,0,-walk)
Character.Torso['Right Hip'].C0=CFrame.new(0, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
Character.Torso['Right Hip'].C1=CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)*CFrame.Angles(0,0,walk)
-- Sitting
elseif Pose == 2 then
Character.Torso['Left Shoulder'].C0=CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
Character.Torso['Left Shoulder'].C1=CFrame.new(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)*CFrame.Angles(0,0,math.pi/2)
Character.Torso['Right Shoulder'].C0=CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
Character.Torso['Right Shoulder'].C1=CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)*CFrame.Angles(0,0,-math.pi/2)
Character.Torso['Left Hip'].C0=CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
Character.Torso['Left Hip'].C1=CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)*CFrame.Angles(0,0,math.pi/2)
Character.Torso['Right Hip'].C0=CFrame.new(0, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
Character.Torso['Right Hip'].C1=CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)*CFrame.Angles(0,0,math.pi/2)
-- Overlord
elseif Pose == 3 then
Character.Torso['Left Shoulder'].C0=CFrame.new(-1, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
Character.Torso['Left Shoulder'].C1=CFrame.new(0.49999997, 0.49999997, 4.47034836e-08, 0.163175777, -0.229498923, -0.959533036, -0.33284384, 0.90274477, -0.272519022, 0.928756475, 0.363843203, 0.0709187835)
Character.Torso['Right Shoulder'].C0=CFrame.new(1, 0.5, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
Character.Torso['Right Shoulder'].C1=CFrame.new(-0.5, 0.5, 0, 0.163175479, 0.229498848, 0.959533155, 0.332843512, 0.902745068, -0.272518843, -0.928756654, 0.363842756, 0.0709186569)
end
local quadratic = false
local baseHatZoom = 30
local maxHatZoom = 100
local cameraOffsetX = 0
local cameraOffsetY = 0
local OnlyCheckHeadAccessoryInHeadShot = false
local headAttachments = {}
if Character:FindFirstChild("Head") then
for _,child in pairs(Character.Head:GetChildren()) do
if child:IsA("Attachment") then
headAttachments[child.Name] = true
end
end
end
local maxDimension = 0
-- Remove gear
for _, child in pairs(Character:GetChildren()) do
if child:IsA("Tool") then
child:Destroy()
elseif child:IsA("Accoutrement") then
local handle = child:FindFirstChild("Handle")
if handle then
local attachment = handle:FindFirstChildWhichIsA("Attachment")
--legacy hat does not have attachment in it and should be considered when zoom out camera
if not OnlyCheckHeadAccessoryInHeadShot or not attachment or headAttachments[attachment.Name] then
local size = handle.Size / 2 + handle.Position - Character.Head.Position
local xy = Vector2.new(size.x, size.y)
if xy.magnitude > maxDimension then
maxDimension = xy.magnitude
end
end
end
end
end
-- Setup Camera
local maxHatOffset = 0.5 -- Maximum amount to move camera upward to accomodate large hats
maxDimension = math.min(1, maxDimension / 3) -- Confine maxdimension to specific bounds
if quadratic then
maxDimension = maxDimension * maxDimension -- Zoom out on quadratic interpolation
end
local viewOffset = Character.Head.CFrame * CFrame.new(cameraOffsetX, cameraOffsetY + maxHatOffset * maxDimension, 0.1) -- View vector offset from head
local positionOffset = Character.Head.CFrame + (CFrame.Angles(0, -math.pi / 16, 0).lookVector.unit * 3) -- Position vector offset from head
local camera = Instance.new("Camera", Character)
camera.Name = "ThumbnailCamera"
camera.CameraType = Enum.CameraType.Scriptable
camera.CoordinateFrame = CFrame.new(positionOffset.p, viewOffset.p)
camera.FieldOfView = baseHatZoom + (maxHatZoom - baseHatZoom) * maxDimension
-- format, width, height, sky, crop
return game:GetService("ThumbnailGenerator"):Click("PNG", 840, 840, true, false)