CFrame Looks Laggy

Hi! So I’m almost done with my football script. I’ve ran into a situation with the football that makes me dislike how it travels in the air. When I don’t use CFrame to readjust the football’s CFrame it moves in the air as intended, smooth and everything. But when I enable the CFrame line the football moves in the air all laggy/jittery making it look bad. How could I fix this?

CFrame Code:

-- Football CFrame --
			while AngularRotation.Enabled do
				task.wait()
				-- Get CFrame Position / Update It --
				local BallPosition = Football.CFrame.Position
				Football.AssemblyLinearVelocity = Football.AssemblyLinearVelocity + Vector3.new(0,BallSettings.Gravity * RunService.Heartbeat:Wait(),0)
				Football.CFrame = CFrame.new(BallPosition,BallPosition + Football.Velocity + BallSettings.Buffer) * CFrame.Angles(math.pi/2,math.pi * 0.35,0)
			end
7 Likes

Why don’t you do it the first way then? Besides that, this is probably a network ownership issue, just do :SetNetworkOwnershipAuto() before you begin setting the CFrame.

2 Likes

is this a remake for football frenzy?

2 Likes

So would I put that inside the while loop or outside?

1 Like

Outside the loop (before you start the loop).

1 Like

This would be jittey because your using task.wait() in a while loop. The answer to this would be to simply tween the football using TweenService

local TweenService = game:GetService("TweenService")
local TweenInfo = TweenInfo.new(task.wait(),--[[Easing Style,Direction ecetra]])
while AngularRotation.Enabled do
	-- Get CFrame Position / Update It --
	local BallPosition = Football.CFrame.Position
	Football.AssemblyLinearVelocity = Football.AssemblyLinearVelocity + Vector3.new(0,BallSettings.Gravity * RunService.Heartbeat:Wait(),0)
	local Goal =  {CFrame = CFrame.new(BallPosition,BallPosition + Football.Velocity + BallSettings.Buffer) * CFrame.Angles(math.pi/2,math.pi * 0.35,0)}
	local Animation = TweenSerivce:Create(Football,TweenInfo,Goal)
	Animation:Play()
	Animation.Completed:Wait()
end
3 Likes

I am sure its because the first way does not respect rotation and its just flying quite boringly therefore OP is not willing to use the first method.

1 Like

Idk if I used tween wrong but when now it does this when I throw the football

I see. The problem now is that your using manual interpolation with Roblox physics engine. A better way to achieve the rotation would be to scratch the idea of using cframes and using BodyGyro mainly AlignOrientation as BodyGyro is deprecated. Now you hopefully wont have lag and you would have the rotation needed.

When I use AlignOreintation it seems like AngularVelocity that im using to spin the ball doesn’t spin anymore. Could I use AlignOreintation to spin the ball or what would I do?

May I ask if the position is jittery or the rotation? As I was not able to see any jittering the video above. So I am quite confused on to what is jittering, position or orientation?

When I would throw it before it would straight up just lag mid air look slow and all that

So its the position that is jittery? For that just tween the orientation of the football. And set it everytime the camera has a change using Camera.Changed that would be faster and more accurate I hope?

When I used your suggestion of using AlignOrentiation it isn’t jittery anymore its very very smooth

So that solved it? Just rotate the attachment your aligning the orientation with.

Now im running into a problem where since I have both AngularVelocity x AlignOrenitation both enabled at the same time it doesn’t spiral the football anymore.

Then just dont use the angular velocity. Instead spin the attachment/part that your aligning the orientation with.

@NoxhazeI Thats what it would travel like if the Align’s MaxTorque was stronger

Alright can I have the configuration of the ball and the align position so I can see whats going on?