- Edited
Hi everyone, first time poster here.
I am developing a third person shooter in Godot 4.1. I have a offset camera following my player at all times and it's working as expected except for when the player is in front of a wall. The SpringArm3D always seem to clip through the wall at some particular angle. I have first tried to change the arm length but it doesn't seem to be the problem. So far making the player's CollisionShape bigger or centering my camera solves the issue, but those are not ideal for my game.
Here's how it look like:
Wall behind player, not clipping
Wall behind player, clipping
View from above, not clipping (added a sphere at the SpringArm3D detect point for visibility)
View from above, clipping
Here is what my tree looks like:
And, here is the code for the CameraController script.
func _input(event):
if event is InputEventMouseMotion:
rotation.y -= event.relative.x / 1000 * sensitivity
rotation.x -= event.relative.y / 1000 * sensitivity
rotation.x = clamp(rotation.x, deg_to_rad(-50), deg_to_rad(89))
Anyone knows what is going on here? Any help would be greatly appreciated. Thanks!