Help with hover phyiscs

Hello, im currently trying to work on a hovering system and I came across an issue that im not sure how to fix (Not sure how to describe so I put a video)

Video of Issue:

My Code:


--//Values
SettingsModule["Stiffness"] = 200
SettingsModule["Height"] = 10
SettingsModule["Damping"] = 10



--//Main
game:GetService("RunService").Heartbeat:Connect(Function()
	local len = SettingsModule["Height"]/2 - (ray.Position-Base.Position).Magnitude
	local f = -SettingsModule["Stiffness"]*len-SettingsModule["Damping"]*Base.Velocity:Dot((Base.CFrame * CFrame.Angles(-90,0,0)).LookVector) + -(Base:GetMass()^3)
	Base.BodyThrust.Force = Vector3.new(0,-f,0)
end)

Thanks in advanced! :sweat_smile:

4 Likes

Are you using derivatives? It seems like you’re completely ignoring past or future information thus the infinite oscillations. (or it could be network ownership issues if that’s a server script so set it to nil since characters somehow have the passive to change nearby part’s network owner)

I did rewrote some of the calculations based off what you had said however, that was not the problem. Thanks for the help!

Without knowing what you did there’s no way I can help. I’m not sure why you marked that other post as solution since you obviously are using damping. But if you managed to solve the issue without anyone’s help you can just mark your own post as solution.

The other post was the solution

But the code sample you posted clearly included a derivative. That’s the *Base.Velocity:Dot(...) part.

Whatever. Glad you fixed the issue. I’ll delete my post since it didn’t help.

Why did you delete your post lol, also network ownership was the issue it was setting to the character so I set it to nil, and now I have a new issue with the body gyro I’m using.

Ah, that makes sense then. Carry on.

Since I set the ownership to nil I can’t control the object on the client so I moved it to the server.
I’m using the a vehicle seat for detection, and for some reason the gyro dosent seem to turn.

here is a sample of my code:

if Base:FindFirstChild("BodyGyro") then
	--	print(steerFloat)
		if steerFloat > 0 then
			SteerT += SettingsModule["MaxSpeedTurnSpeed"]
		--	Base.Rotation = Vector3.new(0,0,SteerT)
			Base:FindFirstChild("BodyGyro").CFrame = Base:FindFirstChild("BodyGyro").CFrame * CFrame.Angles(0,SteerT,0)
		elseif steerFloat < 0 then
			SteerT -= SettingsModule["MaxSpeedTurnSpeed"]
			Base:FindFirstChild("BodyGyro").CFrame = Base:FindFirstChild("BodyGyro").CFrame * CFrame.Angles(0,SteerT,0)
		end

	end

is there another method to solve this? setting the network owner worker however I can no longer manage input on the client so that the vehicle moves (If I handle this on the server it will lag)

So what I do for my chassis is to clone a client script controlling the driving physics into the playergui. (for physics smoothness and since it’s network ownership is going to be the player therefore no need for the server)

If I set the network ownership to the player the bug would could continue, the bug was fixed when I set the network ownership to nil. So I’m not sure what you mean?