I’m basically trying to make the screen shake in sync with a sound playbackloudness, I can use this function but is there anyway to convert it to use x,y,z axis for camera cframes?
function soundPlayback()
local Camera = workspace.CurrentCamera -- reference this somewhere at the top to cache
local Tween = game:GetService("TweenService") -- same with this
local Info = TweenInfo.new(0.10, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut) -- also this.
local Properties
if (sound.PlaybackLoudness/1000) >= 0.30 and Camera.FieldOfView < 74 then
Properties = {FieldOfView = 68 + (sound.PlaybackLoudness/100)}
else
Properties = {FieldOfView = 68 - (sound.PlaybackLoudness/1000)}
end
local T = Tween:Create(Camera, Info, Properties)
T:Play()
end
Choose a random direction to shake in (Try Random:NextUnitVector()), afterwards, multiply it by that PlaybackLoudness modifier to make the shake bigger for louder sounds. Experiment with how often you do this. Obviously with camera being scriptable (unless you have some way to shake default camera).
Yes I figured out my own formula, but my problem is the camera gets locked, is there a way to make it still follow player whilst shaking?
This is how I did it.
Honestly, just throw out the rotation and see how it looks with offset. If you need rotation I believe you will need to do custom stuff, which would not be fun.
Update on this, I used ToOrientation, but the offset isn’t updating at all, why? i removed MoveCameraScale since it just updates the camera position to where the player’s mouse is located.
it all prints 0