Weird physics problems clientside when using ApplyForceCenter

So I’m getting some really buggy physics when I use

PhysObj:ApplyForceCenter and I can’t figure out what causes it.

Here’s a video to show what’s going on

Basically sometimes the ball lags behind. I remember GMod Tower doing something very similar to what I’m doing but they didn’t have this problem. Here’s the code I’m using to calculate where the ball is going:
[lua]
hook.Add(“Move”, “BallPhysics”, function(ply, mv)
if IsValid(ply.Ball) then
local dir = mv:GetMoveAngles()
local fvel = dir:Forward() * mv:GetForwardSpeed()
local rvel = dir:Right() * mv:GetSideSpeed()
local phys = ply.Ball:GetPhysicsObject()

		ply.Ball.QueuedForce = (fvel + rvel) / 1000

		ply.Ball.Player:SetAngles(Angle(0, dir.y, dir.r))
	end
end)

[/lua]

I’ve tried StartCommand, Move and FinishMove for this, and have also tried applying the physics in the hook.

[lua]
hook.Add(“Think”, “BallThink”, function()
for k, ply in pairs(player.GetAll()) do
if IsValid(ply.Ball) then
local phys = ply.Ball:GetPhysicsObject()
ply.Ball.Player:SetPos(ply.Ball:GetPos())

			if IsValid(phys) then
				phys:ApplyForceCenter(ply.Ball.QueuedForce)
			end
		end
	end
end)

[/lua]

I tried this after thinking it was something to do with applying force in a predicted hook but I’m still getting the same problem. I’ve also tried doing this in Tick but it still has the same effect.

Are you 100% sure it’s the client and not the server?

Parent the playermodel to the ball. Don’t use SetPos

Can we see the code for the queued physics force? I assume you’d be doing that inside of PhysicsSimulate or something like that.

Also, in case you’re using a motion controller, are you initializing it shared? Is the ball phys object clientside too?

If you don’t want to paste the entire entity code I can understand.

Physics on the ball look fine to an observer.

I tried this but I don’t want the playermodel rotating with the ball.

The queued force is applied in the think hook (second snippet). Im not using a motion controller and haven’t even heard about them, would they be a better idea to use? I intend on making this ent not just on sandbox as well, does it rely on that?

Make a bone that will rotate the ball, but will not affect the player.

Your making monkey ball :smiley:

How would I do that?