LinearVelocity causing gameplay paused

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Fix the gameplay pause issue

  2. What is the issue? Include screenshots / videos if possible!
    As stated the velocity seems to cause the gameplay pause issue, the velocity is directional and intended that way. I’ve tested it multiple times to the conclusion something is wrong with the velocity directly

Video Reference:
vvura - Roblox Studio (gyazo.com)

local attachment = Instance.new('Attachment')
							attachment.Name = "VelocityAttachment"
							attachment.Parent = rootPart

							local velocity = Instance.new("LinearVelocity")
							velocity.VelocityConstraintMode = Enum.VelocityConstraintMode.Plane
							velocity.Attachment0 = attachment
							velocity.Name = "Velocity"
							velocity.PrimaryTangentAxis = Vector3.new(1, 0, 0)
							velocity.SecondaryTangentAxis = Vector3.new(0, 0, 1)
							velocity.MaxForce = 15000
							velocity.Parent = attachment

							local moveDirection = humanoid.MoveDirection
							local dashDirection = Vector3.new(moveDirection.X, 0, moveDirection.Z).Unit
							local planeVel = Vector2.new(dashDirection.X, dashDirection.Z) * 45.3
							velocity.PlaneVelocity = planeVel

							task.delay(0.20, function()
								if attachment then
									attachment:Destroy()
								end
							end)

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried tweaking with the maxforce Property to see Whether it was the issue I’ve also looked up if theres an issue related to this on devforum none that i could relative to the problem

The gameplay paused thing is because of streaming enabled. Try clicking on the workspace, and in the property menus there are settings under the streaming category. You can simply turn off this pausing if you would like with the StreamingIntegrityMode property, but that would also cause unintended behavior if your player ever ventures out too far too quickly without loading first. Another thing you could do is adjust the min and target radius. Anyway, adjusting these properties should get this to stop pausing your game.

I disabled the property while that did remove the gameplay pausing, it didn’t fix the issue with the velocity the issue kind of now carried over and tweaks out the camera and player?

Interesting, try turning off StreamingEnabled in its entirety. This could cause memory issues for less performant devices, but for now lets see what that does. Also, are you teleporting the player far away or something here before he comes back?

Nope, no kind of teleportation or CFraming just applying velocity so I’m not entirely sure on what’s causing this

The velocity could be too high or powerful which causes the tweak. Maybe experiment around with your forces?

hi there. i think this happens because velocity can’t be (nan, nan, nan).

local moveDirection = humanoid.MoveDirection
local dashDirection = Vector3.new(moveDirection.X, 0, moveDirection.Z).Unit

when you try to index ‘Unit’ on vector3 with 0 magnitude, or value (0, 0, 0), it will return (nan, nan, nan) . this mean when there’s no player movement input, moveDirection become (0,0,0) and dashDirection become (nan, nan, nan) because Unit of (0,0,0) is nan. trying to set velocity to nan value cause the velocity parent, which is humanoidrootpart, to glitch with the camera that is following the humanoidrootpart.

2 Likes

You’re a life saver i ran an additional condition check to prevent this!

local moveDirection = humanoid.MoveDirection
	if moveDirection.Magnitude > 0 then
	 local dashDirection = Vector3.new(moveDirection.X, 0, moveDirection.Z).Unit
	 local planeVel = Vector2.new(dashDirection.X, dashDirection.Z) * 45.3
	 velocity.PlaneVelocity = planeVel
								
else
								
end
1 Like

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