This is a piece of code from my watermod, where I do some splashing effects:
local function SplashEffects(self, waterentity, point, submersionPercentage)
if self:GetIsAlive() then
if Server and waterentity.splashsound then
Shared.PlayWorldSound(nil, waterentity.splashsound, nil, point, waterentity.splashvolume or 1)
end
if Client and waterentity.splashcinematics then
local cinematic = Client.CreateCinematic(RenderScene.Zone_Default)
cinematic:SetCinematic(waterentity.splashcinematics)
cinematic:SetRepeatStyle(Cinematic.Repeat_None)
cinematic:SetIsVisible(true)
local cinematicCoords = self:GetCoords()
cinematicCoords.origin = point + Vector(math.random()*1 - 0.5, 0, math.random()*1 - 0.5)
cinematicCoords.xAxis = cinematicCoords.xAxis * waterentity.splashscale.x
cinematicCoords.yAxis = cinematicCoords.yAxis * waterentity.splashscale.y
cinematicCoords.zAxis = cinematicCoords.zAxis * waterentity.splashscale.z
cinematic:SetCoords(cinematicCoords)
end
end
end
Player.OnEnterWater = SplashEffects
Player.OnExitWater = SplashEffects
As you can see, it gets the Coords of the effect, then scales it, and sets the new Coords for it.
Comments
This is a piece of code from my watermod, where I do some splashing effects: As you can see, it gets the Coords of the effect, then scales it, and sets the new Coords for it.