Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can i dampen the force when it is still? skinned mesh

Asked by
Puppynniko 1059 Moderation Voter
2 years ago
local Boat = script.Parent
local BodyForce = Boat:WaitForChild("Force")
local WaveGenerator = require(game.ReplicatedStorage.Wave2)
local DeapthBeforeSubmerged = 1
local DisplacementAmount = 3
local WaterDrag = .99

local function FixedUpdate()
    local WaveHight = WaveGenerator:Init().GetFloatation(nil,Boat.Position,Vector2.new(Boat.Size.X,Boat.Size.Z))
    local WaveHightYAxis = WaveHight.Y
    --print("WaveHightYAxis is "..WaveHightYAxis.."And the boat Position Y is "..Boat.Position.Y)
    if Boat.Position.Y < WaveHightYAxis then
        print(true)
        local DisplacementMultiplier = math.clamp(WaveHightYAxis-Boat.Position.Y/DeapthBeforeSubmerged,0,1) * DisplacementAmount
        BodyForce.Force = Vector3.new(0,math.abs(workspace.Gravity)*DisplacementMultiplier*Boat:GetMass(),0)
    else
        print(false)
        BodyForce.Force = Vector3.new(0,0,0)
    end
end
while wait() do
    FixedUpdate()
end

i tried to convert as much C# as i can im pretty sure i got every thing working except that it keeps bouncing

1 answer

Log in to vote
0
Answered by 2 years ago

Roblox gravity is weird, so maybe try to lower the height and slow it down. Hope that helps!

Ad

Answer this question