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.

godotengine.org | Twitter

0 votes

Hi,

I have 3 camera scripts with the feat of following the object. But When I change between pretty difference scripts(not very similar ones), it is impossible to define Node Path again.

This one is Interpolated camera:

func _physics_process(_delta):

    target = get_node("../Player").get_path()
#   target = get_node("../Player").get_global_transform().origin
#   var target2 = get_node("../Player/SpringArm2").get_global_transform().origin

    pos = get_global_transform().origin
#   if target:
    var up = Vector3(0,1,0)
    offset = pos - get_node("/root/Node/Player").get_global_transform().origin
    offset = offset.normalized() * Vector3(distance, distance, distance)
    offset.y = height
    height = clamp(height, 4, 10)
    pos = get_node(target).get_global_transform().origin + offset
    look_at_from_position(pos, get_node(target).get_global_transform().origin , Vector3(0,1,0))
    var space_state = get_world().get_direct_space_state()
    var obstacle
    obstacle = space_state.intersect_ray(get_node("/root/Node/Player").get_translation(),  get_translation())
    if not obstacle.empty():
        print(obstacle["collider"])
        look_at_from_position(obstacle.position, get_node("../Player").get_global_transform().origin , Vector3(0,1,0))
    var _look2_1 = 0
    var _look2_2 = 6
    var _look2_3 = float()
    _look2_2 -= height - 10
    _look2_3 -= distance + 40

This one from kidscancode.com. Thanks to him BTW.

> func _process(delta):     if !mouse_control:      get_input_keyboard(delta)
>   $InnerGimbal.rotation.x = clamp($InnerGimbal.rotation.x, -100.4,
> 80.01) #$InnerGimbal.rotation.x = clamp($InnerGimbal.rotation.x, -1.4, -0.01)     rotation.y = clamp(rotation.y, -100.4, 80.01)   scale = lerp(scale, Vector3.ONE * zoom, zoom_speed)
> # target = get_node("../Player").get_path()   if target:      global_transform.origin = get_node(target).global_transform.origin
>       
> # if arrow != null or area != null:   arrow = get_parent().find_node("Arrow")     arrow.global_transform.basis =
> arrow.global_transform.looking_at(get_node("/root/Node/Area").global_transform.origin,Vector3(0,1,0)).basis   arrow.scale = Vector3(arrow_scale, arrow_scale, arrow_scale)
>   get_node("/root/Node_PauseMenu").get_node("RichTextLabel").text =
> String(Engine.get_frames_per_second())
in Engine by (193 points)

I'm sorry but I don't understand what is your question here, could you explain it clearer please ?

I change between scripts and the target node is not applied after changing two scripts

Please log in or register to answer this question.

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.