This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Im trying to make a sort of 3rd person thing and i want the y axis of the camera to be stationary so only the x and z can move, but im having a weird error.

extends Camera3D

func _ready():
    pass # Replace with function body.

func _process(delta):
    self.global_position = Vector3(self.global_position.x, clamp(self.global_position.y, 0, 0.605), self.global_position.z)

btw the error is

Invalid get index 'global_position' (on base: 'Camera3D ()')

Godot version 4.0
in Engine by (21 points)

Hmmm... I don't see anything obviously wrong there. Is that the complete error? It looks a little strange to me. For example, if I intentionally put a typo in the global_position property name to generate a similar error (because the actual property works fine here), I get the following error:

Invalid set index 'global_positionz' (on base: 'Camera3D') with value of type 'Vector3'.

While it's similar to your error, I'd expect it to match exactly - unless you haven't pasted the compete error?

Really, grasping at straws here as the code looks OK to me on the surface...

Ah, wait. I see the error difference. I broke the set side of the expression. In your case, it's the get side. So, my replicated error looks like this now (again, with an intentionally broken property name)

Invalid get index 'global_positionz' (on base: 'Camera3D').

Just set up a test scene to verify. That code works perfectly fine here (using Godot 4, beta 12).

hmm, thats odd, im using Godot 4, Alpha 9 right now.

I found out why, i was using 4.0 version 9 and for some reason it only works on version 12

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.