The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

In Godot, it seems that only the 2D camera has the option "Limit" allowing the camera not to follow the Player all the time according to the values of "Limit".

But the 3D Camera does not have this tab and does not stop following the Player permanently.

Solution ideas?

(Yes, I am a beginner and I am lost.)

in Engine by (24 points)

1 Answer

+1 vote

First, separate the camera from the player, and make it follow the player with a script.

Then just stop moving it when reaches some fixed values.

More dynamic ways can be attaching the camera to a CollisionObject that moves in its own allowed zones trying to follow the player (blocked with bodies ignored by the player).

by (7,890 points)


Thank you for your reply. After watching a few tutorials, I realized how easy the solution to this question was. Thanks to my research, I was able to create a script that works perfectly. Thanks again for your time and patience!

extends Camera

# Max and Min in the x axis
export var xMax = 0.0
export var yMax = 0.0  
# Max and Min in the y axis
export var xMin = 0.0
export var yMin = 0.0
# Smooth Camera Trigger and SmoothSpeed value
export var Smooth = false
export var SmoothSpeed = 0.125

func _ready():

func _process(delta):

var Target = get_node("/root/World/Main Player").get_translation()
var Own = get_node(".")

var Start = get_node(".").get_translation()

var Clampx = clamp(Target.x, xMin, xMax)
var Clampy = clamp(Target.y, yMin, yMax)
var Clampz = Own.get_translation().z

var All = Vector3(Clampx, Clampy, Clampz)

if Smooth == false:
if Smooth == true:
    var Lerp = Start.linear_interpolate(All, SmoothSpeed)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.