SpringArm component exclude collider not working.

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

I am trying to create a third person character.
I have this setup for the character: Imgur: The magic of the Internet

This is an extract of my orbit camera code:

    // This gets called in the _Ready() method. It finds the KinematicBody (which is root) child shapes.
    // I checked using a GD.Print and it does indeed add the collision shape to the ExcludedObjects.
    private void ExcludeParentChildColliders()
	{
		Godot.Collections.Array nodes = TargetNode.GetChildren();

		foreach(Node node in nodes)
		{
			if(node is CollisionShape)
			{
				CollisionShape collider = (CollisionShape)node;
				AddExcludedObject(collider.Shape.GetRid());
			}
		}
	}

	// Called every frame. 'delta' is the elapsed time since the previous frame.
	public override void _Process(float delta)
	{
		// Check look up/down limits.
		if(Rotation.x < -Math.PI / 2)
		{
			Rotation = new Vector3((float)-Math.PI / 2, Rotation.y, Rotation.z);
		}
		else if(Rotation.x > Math.PI / 2)
		{
			Rotation = new Vector3((float)Math.PI / 2, Rotation.y, Rotation.z);
		}

		base.Rotation = Rotation;
	}

For some reason, the collider of the player is still sometimes detected causing the effect here: https://youtu.be/PFAAiObl4Ow

Any suggestions on what causes this problem and how to fix it would be appreciated.

:bust_in_silhouette: Reply From: Yiannis Charalambous

So I have found an answer, apparently don’t add to the exclusion the collision shape but add the kinematic body that uses the collision shape.