AssemblyLinearVelocity effected by FPS causing inconsistencies?

All the links you posted lead to 404 pages… There isn’t any Assembly class in Roblox’s Engine API…

I apologize for the incorrect links. The Assembly module is not part of the Roblox Engine API, and is not documented on the Roblox Developer Hub.

The Assembly module is an internal module used by Roblox to implement the physics engine, and is not intended for use by developers. It is not recommended to use the Assembly module in your own code, as it may change or be removed in future updates to Roblox.

Instead, you should use the BodyForce and Velocity properties provided by the BodyMover and BodyVelocity objects to apply forces and set velocities on objects in your game. These properties are part of the public Roblox API and are intended for use by developers.

Here are some resources that provide more information on the BodyMover and BodyVelocity objects:

I apologize for the confusion. Let me know if you have any other questions.

I just want to make a note that BodyVelocity is deprecated.

Like at least check to see if ChatGPT is providing you accurate information before just posting it.

4 Likes

zam seems to be using that chat AI, all his respones follow that AI’s pattern of replies.

4 Likes

Really? Using ChatGPT for answers?

4 Likes

If anyone with actual knowledge of fixing this can reply it would be much appreciated, ChatGPT help is not what im looking for…

1 Like

In an attempt to try and move this discussion in someway… Have you tried any of what’s listed in this description box? It’s part of this post… Understanding Assemblies | Roblox Creator Documentation

I will admit, I took a break from Roblox so all of these are new to me, I’m just hoping to provide some catalyst for help.

1 Like

:ApplyImpulse() has the same problem, and i cant see using a VectorForce will work any differently but I guess I can give it a try.

Edit: No they don’t behave how I want, so even if they were not affected by it they would be useless.

@zam_gion Please don’t plagize ChatGPT responses without telling people you’re getting your answers from ChatGPT. ChatGPT’s reponses look legitimate but are almost always wrong and a waste of people’s time. You didn’t even bother to look if the links were real (they aren’t).


@PastDays Could we see the code that moves the character? I suspect the problem is either with your code or the character controller.

The character controller has downwards force thing that makes characters stick to the ground even when a force (greater than gravity) is pulling them upwards. This sticking force is probably FPS dependent. You might want to use a LinearVelocity to add the velocity so the required force is used to change the velocity. You could just create the LinearVelocity, set the LinearVelocity’s velocity, parent the LinearVelocity, and destroy it after a second (it would only need about a tenth of a second to reach the correct velocity).

1 Like

Sure, though the code works fine, I’m not entirely sure what you mean but I can give LinearVelocity another go, but it just wasn’t working how i’d like it too.

------------------------------------------------------------------------------------------------------------
---[SERCIVES]
local UserInputService = game:GetService("UserInputService")

------------------------------------------------------------------------------------------------------------
---[LOCALS]
local Player_Movement = script.Parent
local Movement_Values = Player_Movement.Movement_Values

local Player = game.Players.LocalPlayer
local Character = Player.Character

local Boosting = false
local Cool_Down = false
local Initial_Boost = 30
local Hover_Boost = 6.2
------------------------------------------------------------------------------------------------------------
---[BOOST JUMP]

UserInputService.InputBegan:Connect(function(inst, gameProcessedEvent)
	if inst.KeyCode == Enum.KeyCode.Space and Character.Humanoid:GetState() == Enum.HumanoidStateType.Freefall and Cool_Down == false and not gameProcessedEvent then
		--# DEBUG
		print("Double Space Down")
		
		--# Begin Setup For Boosting
		Boosting = true
		
		Character.Humanoid.JumpHeight = 0
		Character.Boost_Backpack.Boosting_Sound:Play()
		
		--# Show Boosting Visuals
		Character.Boost_Backpack.Left_Node.Water_Jet_Particles.Enabled = true
		Character.Boost_Backpack.Left_Node.Water_Jet_Particles_2.Enabled = true
		Character.Boost_Backpack.Left_Node.Water_Jet_Particles_3.Enabled = true

		Character.Boost_Backpack.Right_Node.Water_Jet_Particles.Enabled = true
		Character.Boost_Backpack.Right_Node.Water_Jet_Particles_2.Enabled = true
		Character.Boost_Backpack.Right_Node.Water_Jet_Particles_3.Enabled = true
		
		--# Begin To Hover Character
		local HRP = Character.HumanoidRootPart
		local HRP_ALV = HRP.AssemblyLinearVelocity
		
		Character.HumanoidRootPart.AssemblyLinearVelocity = Vector3.new(HRP_ALV.X, Initial_Boost, HRP_ALV.Z)
		
		while Boosting == true and Character.Humanoid:GetState() == Enum.HumanoidStateType.Freefall do wait()
			local HRP_ALV_NEW = HRP.AssemblyLinearVelocity
			
			Character.HumanoidRootPart.AssemblyLinearVelocity = Vector3.new(HRP_ALV_NEW.X, HRP_ALV_NEW.Y + Hover_Boost, HRP_ALV_NEW.Z)
		end
		
		--# Clean Up Once Landed
		
		Cool_Down = true
		Boosting = false

		Character.Boost_Backpack.Left_Node.Water_Jet_Particles.Enabled = false
		Character.Boost_Backpack.Left_Node.Water_Jet_Particles_2.Enabled = false
		Character.Boost_Backpack.Left_Node.Water_Jet_Particles_3.Enabled = false

		Character.Boost_Backpack.Right_Node.Water_Jet_Particles.Enabled = false
		Character.Boost_Backpack.Right_Node.Water_Jet_Particles_2.Enabled = false
		Character.Boost_Backpack.Right_Node.Water_Jet_Particles_3.Enabled = false

		Character.Boost_Backpack.Boosting_Sound:Stop()

		while Character.Humanoid:GetState() == Enum.HumanoidStateType.Freefall do wait() end
		
		Character.Humanoid.JumpHeight = 7.2
		Cool_Down = false
	end
end)

UserInputService.InputEnded:Connect(function(inst)
	if inst.KeyCode == Enum.KeyCode.Space then
		--# DEBUG
		print("Space Up")

		if Boosting == true then
			Cool_Down = true
			Boosting = false

			Character.Boost_Backpack.Left_Node.Water_Jet_Particles.Enabled = false
			Character.Boost_Backpack.Left_Node.Water_Jet_Particles_2.Enabled = false
			Character.Boost_Backpack.Left_Node.Water_Jet_Particles_3.Enabled = false

			Character.Boost_Backpack.Right_Node.Water_Jet_Particles.Enabled = false
			Character.Boost_Backpack.Right_Node.Water_Jet_Particles_2.Enabled = false
			Character.Boost_Backpack.Right_Node.Water_Jet_Particles_3.Enabled = false

			Character.Boost_Backpack.Boosting_Sound:Stop()

			while Character.Humanoid:GetState() == Enum.HumanoidStateType.Freefall do wait() end

			Character.Humanoid.JumpHeight = 7.2
			Cool_Down = false
		end
	end
end)

Please don’t make fake answers with ChatGPT :roll_eyes:

This is false. AssemblyLinearVelocity sets the velocity. It in no way is “applied over a fixed number of frames”.

This does not exist, this is Unity API mixed with Roblox’s.

Also doesn’t exist.

3 Likes

LinearVelocity basically uses as much force as necessary to change the velocity. This means it can counteract the ground force the character controller has.

This bit is frame rate dependent, but I don’t see how that would significantly affect the result unless the frame rate is like 10 fps. You could use events, but I don’t think that would change the result. The rest of the code looks good.

Edit: The problem was that the code was adding to the velocity every wait(), which is based on the frame rate. (I thought the code was just setting the velocity.)

2 Likes

Yea, seems like that is exactly my problem, I use a little script (I did not make it) to limit my FPS to test for things.

local Player = game.Players.LocalPlayer

script.Parent = nil

local Frames_per_second = 20

while game:GetService("RunService").RenderStepped:Wait() do
	 local t0 = tick()
	game:GetService("RunService").Heartbeat:Wait()
	repeat until (t0+1/Frames_per_second) <= tick()
end

Even at 50 fps the boost height has changed enough to decide whether you make the jump or not, I’ll try a faster loop to see if that helps or not.

1 Like

I know BodyVelocities are depreciated, but maybe try this code:

------------------------------------------------------------------------------------------------------------
---[SERCIVES]
local UserInputService = game:GetService("UserInputService")

------------------------------------------------------------------------------------------------------------
---[LOCALS]
local Player_Movement = script.Parent
local Movement_Values = Player_Movement.Movement_Values

local Player = game.Players.LocalPlayer
local Character = Player.Character

local Boosting = false
local Cool_Down = false
local Initial_Boost = 30
local Hover_Boost = 6.2
------------------------------------------------------------------------------------------------------------
---[BOOST JUMP]

UserInputService.InputBegan:Connect(function(inst, gameProcessedEvent)
	if inst.KeyCode == Enum.KeyCode.Space and Character.Humanoid:GetState() == Enum.HumanoidStateType.Freefall and Cool_Down == false and not gameProcessedEvent then
		--# DEBUG
		print("Double Space Down")
		
		--# Begin Setup For Boosting
		Boosting = true
		
		Character.Humanoid.JumpHeight = 0
		Character.Boost_Backpack.Boosting_Sound:Play()
		
		--# Show Boosting Visuals
		Character.Boost_Backpack.Left_Node.Water_Jet_Particles.Enabled = true
		Character.Boost_Backpack.Left_Node.Water_Jet_Particles_2.Enabled = true
		Character.Boost_Backpack.Left_Node.Water_Jet_Particles_3.Enabled = true

		Character.Boost_Backpack.Right_Node.Water_Jet_Particles.Enabled = true
		Character.Boost_Backpack.Right_Node.Water_Jet_Particles_2.Enabled = true
		Character.Boost_Backpack.Right_Node.Water_Jet_Particles_3.Enabled = true
		
		--# Begin To Hover Character
		local HRP = Character.HumanoidRootPart
		local HRP_ALV = HRP.AssemblyLinearVelocity
		
		local bv = Instance.new("BodyVelocity")
		bv.Velocity = Vector3.new(HRP_ALV.X, Initial_Boost, HRP_ALV.Z)
		bv.Parent = Character.HumanoidRootPart
		
		while Boosting == true and Character.Humanoid:GetState() == Enum.HumanoidStateType.Freefall do wait()
			local HRP_ALV_NEW = HRP.AssemblyLinearVelocity
			bv.Velocity = Vector3.new(HRP_ALV_NEW.X, HRP_ALV_NEW.Y + Hover_Boost, HRP_ALV_NEW.Z)
		end
		bv:Destroy()
		
		--# Clean Up Once Landed
		
		Cool_Down = true
		Boosting = false

		Character.Boost_Backpack.Left_Node.Water_Jet_Particles.Enabled = false
		Character.Boost_Backpack.Left_Node.Water_Jet_Particles_2.Enabled = false
		Character.Boost_Backpack.Left_Node.Water_Jet_Particles_3.Enabled = false

		Character.Boost_Backpack.Right_Node.Water_Jet_Particles.Enabled = false
		Character.Boost_Backpack.Right_Node.Water_Jet_Particles_2.Enabled = false
		Character.Boost_Backpack.Right_Node.Water_Jet_Particles_3.Enabled = false

		Character.Boost_Backpack.Boosting_Sound:Stop()

		while Character.Humanoid:GetState() == Enum.HumanoidStateType.Freefall do wait() end
		
		Character.Humanoid.JumpHeight = 7.2
		Cool_Down = false
	end
end)

UserInputService.InputEnded:Connect(function(inst)
	if inst.KeyCode == Enum.KeyCode.Space then
		--# DEBUG
		print("Space Up")

		if Boosting == true then
			Cool_Down = true
			Boosting = false

			Character.Boost_Backpack.Left_Node.Water_Jet_Particles.Enabled = false
			Character.Boost_Backpack.Left_Node.Water_Jet_Particles_2.Enabled = false
			Character.Boost_Backpack.Left_Node.Water_Jet_Particles_3.Enabled = false

			Character.Boost_Backpack.Right_Node.Water_Jet_Particles.Enabled = false
			Character.Boost_Backpack.Right_Node.Water_Jet_Particles_2.Enabled = false
			Character.Boost_Backpack.Right_Node.Water_Jet_Particles_3.Enabled = false

			Character.Boost_Backpack.Boosting_Sound:Stop()

			while Character.Humanoid:GetState() == Enum.HumanoidStateType.Freefall do wait() end

			Character.Humanoid.JumpHeight = 7.2
			Cool_Down = false
		end
	end
end)

(BodyVelocities are faster to code/create than LinearVelocities)
(The body velocity can potentially use infinite force to meet the velocity, so the velocities should be the same regardless of framerate.)

2 Likes

Thank you, I’ll give it some tweaks and see how it goes.

1 Like

The problem I have is that BodyVelocity cancels out movement while applying the force, so you cant move mid boost and also due to the fact it negates gravity it doesn’t allow you to slowly float down.

1 Like

Don’t rely on ChatGPT all the time!!! Apparently it also supplies human-based errors sometimes.

You should know that they use constraints over the old legacy body movers. So now you will use LinearVelocity | Roblox Creator Documentation instead.

Problem is it cancels out movement, Also due to it cancelling out gravity it doesn’t allow you to slowly float back down, Which means it doesn’t work like the old body movers, they have depreciated body movers and insufficiently replaced them.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.