Many issues with Humanoid and AlignPosition / Orientation

I’ve come across a set of confusing issues when trying to move my character using AlignPosition/AlignOrientation that seem to be related to humanoid:

In the attached place there are 4 mostly identical characters, each with an AlignPosition in the HumanoidRootPart that tries to align the character to a red part above it. All parts in the characters are Massless. All of the characters should align, but they only do in some cases.

Rig 1: 5k MaxForce → does not align but slowly floats in odd direction
Rig 2: 5k MaxForce, Accessories are not present → Aligns
Rig 3: 100k MaxForce → Aligns
Rig 4: 5k MaxForce, Humanoid.EvaluateStateMachine = false → Flings oddly and does not align

Sometimes removing a single accessory will cause a completely non-aligning rig to start aligning. Similar issues exist for AlignOrientation, where instead of aligning it starts pendulum motion.

Repro.rbxl (127.4 KB)

Expected behavior

I expect all the rigs to align to the red parts.

3 Likes

You said all the Parts in the Characters are Massless true. Does that mean all the Accessories are Massless true as well? If not then try that.

Using Mover forces on Humanoids (which have their own physics driven controls) is messy from what I understand.

Why aren’t you using Humanoid.MoveTo or Pathfinding? Are the Humanoids designed to slide around like chess pieces or actually walk to their destination?

1 Like

Let me walk you through what I can see in your repro placefile, so we can figure out what you’re actually trying to achieve.

Accessory Vaporwings weights ~75 units, you have Gravity set in your Workspace to be equal 196.2, which is the default value. For AlignPosition to be able to counteract gravity you’ll need to set MaxForce in your AlignPosition constraint to be at least MaxForce = 75 * 196.2 = 14715.

I’ve actually set MaxForce to be equal to 15000 for the 4th rig and it aligns as expected. By choosing a higher value you can make it move faster to the target position.

For the first rig though, AlignPosition battles Humanoid physics, as @Scottifly pointed out, so you need to set a higher value there.

I see two things which can probably be improved to at least reduce confusion:

  1. Vaporwings property Massless is set to true, but it still has mass, because, as documentation states:

If the part is its own root part according to AssemblyRootPart, this will be ignored for that part, and it will still contribute mass and inertia to its assembly like a normal part.

  1. Humanoid physics requires more force for it to move, as Humanoid tries to stay under control.

It depends on your use case, but I might suggest several options here:

  1. Utilize Character Controllers to achieve behavior you want to achieve. You can refer to the original post to get even more information about Character Controllers.

  2. Disable Humanoid.EvaluateStateMachine (Rig 4) and set RootPriority = 1 to the HumanoidRootPart and pay close attention to the resulting mass of an assembly, setting MaxForce accordingly if you wish your character to be controlled like a physical body.

  3. Use Rig 1, but still set RootPriority = 1 to the HumanoidRootPart and tweak MaxForce in the “Run” mode in the Studio until you get satisfactory results. This way character will still have some authority where it wants to go, but you can apply force for it to battle it and move it to the position you want it to move.

If you can describe your use case in more detail we can find the solution that will suit your situation best.

2 Likes

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