0 votes

so my camera is set up with self.setperspective(fovoffset, 0.1, drawdistance) where fovoffset is 65, and drawditance is a slider from 50 to 500.
this is a 3rd person camera, i used someone elses code as a starting point but cannot find the source anymore. I have modified it a lot since then too.
the cameras center of rotation seems to be changing equle to the distance from the center of the world. if i rotate the camera around the mesh in the center of the world the mesh remins in the center of the screen, if i do the same 100 units out, the mesh can be anywhere upto 25% off the center of the screen.
center of world: http://prntscr.com/hlmjgp
100 units offset: http://prntscr.com/hlmk7f
scene hierarchy:

player >>
:>body>Pos>Camera>static body + collider(x)
:>char (male.scn)>kinimatic body (x)>collider (x)>raycast (x)
(x) = not used

#script from Camera node
onready var body = get_parent().get_parent()
onready var selfPos = get_parent()
func _update_transform():
    selfPos.set_translation(body.get_translation() + offset)
    var target_pos = selfPos.get_translation()
    if _pitch < -1.3:
        _pitch = -1.3
    elif _pitch > 1.5:
        _pitch = 1.5
    var pos = Vector3(cos(_yaw) * cos(_pitch), sin(_pitch), sin(_yaw) * cos(_pitch))
    pos *= radius
    look_at_from_pos(target_pos + pos, target_pos, Vector3(0,1,0))

body is a spartial node set as perany to the mesh
selfPos is a position 3D node as a child of body

#script from body node
onready var camera = get_node("Pos/Camera")
func _fixed_process(delta):
    var view_forward = -camera.get_transform().basis.z
    var view_right = -camera.get_transform().basis.x
    var forward = Vector3(view_forward.x, 0.0, view_forward.z).normalized()
    var right = view_right
in Engine by (21 points)

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 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 webmaster@godotengine.org with your username.