How would I make smooth screenshake using math.noise or something like that and had adjustable things like magnitude and roughness? I know I can just use EZ screen shake but I really want to make my own module/script…
(post deleted by author)
Doesn’t quite work… It just moves the camera in a weird way and you can’t rotate it
You could try Humanoid.CameraOffset
? But it might not be the desired effect.
You’re not using Vector3, perlin noise, or cframes right. It seems like a mix of Lua and C#, so that’s why it looks AI generated. Assuming transform.position
is equal to Camera.CFrame.Position
, it will still look wrong because the camera would move too far away from the original position.
Coming back to OP’s original question, when there is an already well-made resource which does what you want, try to use it. In this way, you can understand the logic and, once you get creative, can modify it to your liking. Btw EZ-CameraShake is superseded by Shake.
I tried doing that, but the module was just too complicated for me to process
You don’t have to understand how it works though, it has a nice interface you can use.
What are you trying to achieve? Could you further elaborate? So I can recommend other solutions.
I want to make a smooth screenshake that is sustained and has two values, magnitude and roughness. When one or two of those values change, the screenshake would change with it… I hope this makes sense
Ez camera shake was ported from unity.
Consequently you should look at unity based tutorials like the one below.
I find that the examples given are pretty useful to knowing where to start such as rotational vs position shaking.
Ok, I’m going to try to make my own screenshake by compiling every information that was stated here…
Ok so I tried doing
local x = magnitude * math.noise(tick()*roughness,0)
local y = magnitude * math.noise(tick()*roughness,0)
local z = magnitude * math.noise(tick()*roughness,0)
But it just returns 0 on each variable… Anything I did wrong? (the magnitude and roughness are not 0)
To add onto @dthecoolest response, I’d also suggest this tutorial which is in unity but can be ported to roblox with ease.
Wow… I actually managed to do it
local frequency = 1
local t = 0
repeat wait() until game.Players.LocalPlayer.Character
repeat wait() until game.Players.LocalPlayer.Character.Humanoid
game:GetService("RunService").RenderStepped:Connect(function(deltaTime)
t += deltaTime
local x = math.noise(0,t*frequency) - 1
local y = math.noise(1,t*frequency) - 1
game.Players.LocalPlayer.Character.Humanoid.CameraOffset = Vector3.new(x,y,0)
end)
It is very simple but now I think I get it
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.