ControllerManager does not respect current velocity when changing physics controllers

Currently, as of 2/7/24, if you set a ControllerManager’s ActiveController on the fly, the controller manager resets its velocity before using the new controller.

To reproduce:

  1. Open the place file attached to this bug report
  2. Run a playsolo session
  3. Run up to full speed, then jump. Observe that your horizontal velocity is reset to 0

Repro place file:
ControllerManager_VelocityRepro.rbxl (56.8 KB)

Expected behavior

It is expected that existing velocity would be respected when switching physics controllers

It looks like you have this line in your Jumping lua script:

Avatar.PrimaryPart.AssemblyLinearVelocity = Vector3.new(0, 80, 0)

So you’re setting the horizontal velocity to 0.

As per AssemblyLinearVelocity documentation:

Setting the velocity directly may lead to unrealistic motion. Using a VectorForce constraint is preferred, or use BasePart:ApplyImpulse() if you want instantaneous change in velocity.

2 Likes

:man_facepalming:

This is one of those gamedev moments for me, I didn’t even realize. Apologies for the false bug report!

1 Like

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