You can write your topic however you want, but you need to answer these questions:
- So, I’m making my own custom water, and have successfully got waves working. The biggest problem I have right now is getting my parts to float realistically. I’ve been trying for hours and looked at other posts about the same thing, but I just can’t get it to work.
local WaveModule = require(game:GetService("ReplicatedStorage").WaveModule)
local RunService = game:GetService("RunService")
local OceanTiles = workspace.Tiles:GetChildren()
local floatingObject = workspace.FloatingObject
local vectorForce = nil
local oceanFloorPosition = Vector3.new(0, -60, 0)
local oceanHeight = math.abs((OceanTiles[math.random(1, #OceanTiles)].Plane.Position - oceanFloorPosition).Magnitude)
RunService.Stepped:Connect(function(deltaTime)
local inWater, distance = WaveModule.inWater(floatingObject)
if inWater then
local closestBone = WaveModule.getClosesBone(floatingObject, workspace.Tiles.WaterPlane1.Plane)
if vectorForce then
print(10 * math.clamp(distance / oceanHeight - .3, 0, 1))
vectorForce.Force = Vector3.new(0, floatingObject.PrimaryPart.Mass * workspace.Gravity * (15 * math.clamp(distance / oceanHeight - .3, 0, 1)), 0)
else
vectorForce = Instance.new("VectorForce")
vectorForce.Attachment0 = floatingObject.Base.Attachment
vectorForce.Parent = floatingObject.Base
vectorForce.ApplyAtCenterOfMass = true
vectorForce.RelativeTo = "World"
end
else
if vectorForce then
vectorForce:Destroy()
vectorForce = nil
end
end
end)
The problems I’ve ran into are either oscillations or that the object just sinks.
Please help me, thanks!