How would I do sprites the way DOOM does it? Like, what I mean is when you look at an object from a different angle, it’s sprite changes.
Need more information as to what you’re trying to accomplish.
Alright, so what I’m trying to say is. You know how sprites in DOOM work? When you look at them from different camera angles, their sprite changes accordingly. EX: A sprite facing forward would turn into a diagonal sprite after looking at it from a different angle.
Oh use the LookVector of the Sprite (the direction that the sprite is looking in) and find the Dot product between that and the camera’s LookVector
Haha! I was literally doing the same thing… I found a useful tutorial and practically converted his GDScript to Luau. The video was rather informative and helped me understand the dot product a bit more than I already knew so please watch his tutorial. Also, something that should be stated here is that there not really a good/easy method of created 2d sprites in the 3d world in Roblox.
local spritePart = workspace:WaitForChild("Sprite") local sprite = spritePart:WaitForChild("Beam") -- you cannot use beams with sprite sheets... so either use a billboard gui, surface gui. local camera = workspace.CurrentCamera local runservice = game:GetService("RunService") local function updateSprite() if (camera == nil) then return end -- instead of using camera.CFrame.LookVector i did this because it would act all weird whenever the part was slightly higher or lower than the camera. local p_fwd = CFrame.new((Vector3.new(camera.CFrame.Position.X, spritePart.CFrame.Position.Y, camera.CFrame.Position.Z)), spritePart.CFrame.Position).LookVector local fwd = spritePart.CFrame.LookVector local left = -spritePart.CFrame.RightVector local l_dot = left:Dot(p_fwd) local f_dot = fwd:Dot(p_fwd) local right = false if (f_dot < -0.85) then sprite.Color = ColorSequence.new(Color3.new(1, 1, 1)) -- front elseif (f_dot > 0.85) then sprite.Color = ColorSequence.new(Color3.new(0, 0, 0)) -- back else right = (l_dot > 0) if (math.abs(f_dot) < 0.3) then sprite.Color = ColorSequence.new(Color3.new(0, 0.631373, 0)) -- left elseif (f_dot < 0) then sprite.Color = ColorSequence.new(Color3.new(0, 1, 0)) -- forward left else sprite.Color = ColorSequence.new(Color3.new(0, 0.27, 0)) -- backward left end end end runservice.RenderStepped:Connect(updateSprite)