I am trying to create a third person character.
I have this setup for the character: https://imgur.com/a/HZmDpPZ
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.