SpringArm Has Unexpected Behavior In 4.1

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Krotack

As of Godot 4.0 my character controller worked perfectly.
Today I updated to 4.1 and the SpringArm no longer functions correctly.

Let me clarify that it works fine at normal running speeds, but for development purposes I speed my character up to run extremely fast, and that’s when the issue occurs.

The pivot point for my spring arm is inside of my characters head, though when I’m running forward at a fast speed the camera jumps inside of the characters head, almost as if it’s colliding with the outside of the toons head. This only happens when I’m running forward, not when I’m running to the side, or running backwards towards the camera.

Also if I run forward against the wall the character obviously isn’t moving but rather running in place, the issue does not occur while running in place. Only while running forward at a fast speed does the SpringArm snap the camera to the pivot point/SpringArm origin.

If I move the SpringArm pivot/origin behind the head a little bit the issue mostly goes away, though I still see flashes of the snapping on random frames.

If anybody has experienced this or knows what is happening please let me know, thanks!

:bust_in_silhouette: Reply From: Krotack

I have found the solution to this problem for all others who run into it.

As of Godot 4.1 “SpringArm” treats the character controller body/collision that its attached to as a possible collision for whatever reason. This may or may not be a bug, though I suspect it probably is when you consider how inconsistent its behavior is. The character must be moving quickly for the collision to take place, as well as only at specific camera angles does the collision happen.

In Godot 4.0 and previous versions the SpringArm node automatically ignored the character its attached to and ignored all self-collisions.

In a nutshell: Godot’s built-in SpringArm is colliding inconsistently with the collider attached to the character.

The solution to this problem is to force the SpringArm to ignore collisions with itself and everything else within its root hierarchy (all ancestry up to the root node of the character).

On process ready in the root node for your character add this code:

$SpringArm3D.add_excluded_object(self)

First reference your SpringArm3D (drag and drop from the tree for its location), then add the .add_excluded_object(self) modifier to that. “Self” in this case is a reference to the root node that the script is attached to, that may change depending on if your character script is on the root node or not.

Hope this helps anybody with the problem.