Align Position latency while running on client physics

Help! I am struggling with this problem for about 2 days now.

What I’ve tried so far:

  • Enabling Rigidity and increasing Responsiveness on the AlignPosition/AlignOrientation constraints.
  • Using different update methods: BindToRenderStep, RenderStepped, PostSimulation.
  • Changing the update order of movement vs. hands.
  • Updating Align Position manually by using OneAttachment mode after setting the world cframe of the hand attachments.

I have no idea at all what the problem might be.
Im currently using

RunService:BindToRenderStep(“Update”,Enum.RenderPriority.First.Value,function(deltaTime) self:Update(deltaTime) end)

to update everything.

The update loop looks like this currently:

function Controller:Update(deltaTime)
self:Move(deltaTime)
self:UpdateHands(deltaTime)
end

The function Move() applies the velocity to the loco ball and updates the height, camera and limbs of the character. UpdateHands() is self explanatory.

Has anyone run into this kind of issue before? Could it be caused by something subtle with the update order, physics steps, or the way AlignPosition/AlignOrientation works with a custom character controller?

Any guidance would be greatly appreciated!

Have you looked into this event under VRService? Maybe it’s the solution here.
https://create.roblox.com/docs/reference/engine/classes/VRService#UserCFrameChanged

No, honestly, I don’t think it will work, but I will try.

1 Like

It’s not a good idea to use CFrame movements with Roblox physics Constraints such as AlignPosition.

There is often lag when doing this type of movement. If you are reading a CFrame can you CFrame Lerp the movement of the hands to the next position?

Not sure what you mean but the thing im implementing right now works in my older projects to this day. Align Position is set to max responsivness so it should instantly snap in to the desired CFrame and the thing is i need collisions for the hands.

The problem might be happening with the custom movement itself (the loco ball) I still didn’t fix this

Do you have any Beta features enabled on your new place that you don’t have on your older projects?

No everything is the same. I tested the older project a few days ago, it works perfectly fine.

I finally fixed it! When applying the position to the constraint, I add the root’s AssemblyLinearVelocity divided by a specific prediction value.

hand.Shape.AlignPosition.Position = handCFrame.Position + self.Root.AssemblyLinearVelocity / PredictionValue

The prediction value is selected based on the current FPS using the following table:

local FrameValuesPredictionTable = {
[“60”] = 35.75,
[“120”] = 44.25,
[“144”] = 45,
[“180”] = 45.5,
[“244”] = 50.5,
}

It works well. If your current FPS is not found in the table, it linearly interpolates between the two nearest known keys. For example, if your FPS is 165, it interpolates between 144 and 180, giving a value of approximately 45.25.

The tiny lag you might notice isn’t a problem, since the system is predicting the hand’s movement.

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