Recently I’ve been thinking about how to make Screen Shake that’s the least disruptive as possible.
Camera Offset is fine, but looks quite harsh. CFrame.Angles() is too disruptive as it can move away from buttons etc.
To solve this I’ve been trying to figure out how to make something similar to this:
So far I’ve realized that this effect only seems to work when camera type is set to ‘Scriptable’, which I can’t use as the player needs to be able to move. I’ve also tried setting type to scriptable, then back to custom in a loop which I decided not to do since it’s really bad practice.
have you looked into the tween service at all? set the camera type to ‘Scriptable’ and use the tweenservice to smoothly move the camera to where you want it to go. you can also set the move time and the easing style. i recommend you set the easing style to ‘Elastic’ for the best shaking effect.
Please don’t use this code, it has so many wrong things with it.
Let’s start with the use of delay() here which is pointless if you’re setting the delay to 0, there are better alternatives to this like coroutine.wrap which creates a new thread instantly instead of waiting for 0.03 seconds like delay() does.
Secondly, you shouldn’t be writing offset(cam.CFrame * CFrame.Angles(0,-0.02,0),0.05) wait(0.05) like that multiple times inside a single function, instead they should be inside a for loop and use two different tables or a 2 dimensional array to save the wait() and Cframe.Angles values and call the values depending on how many times did the loop repeat.
Third, you didn’t even show or mention about the offset() function in the code you sent which leads me to the 4th point to the fact that you didn’t even make this code or tell who made this code and just posting his code and referencing him as “Also I didn’t make this so credits to who made it.”. If this isn’t your code and you don’t know who made it, don’t post it.
I don’t even have to mention the fact that you didn’t explain how does the code work or which idea in mind it was designed around with in your post because I seriously don’t think you know the answer to that yourself.
Yup! Works perfectly. Thanks for that, I never thought to actually move the thing it locks to rather than the camera itself. I’m assuming it worked as the axis it needed to shake on is locked to the rotation of the character’s head.