The above code exactly. Everything else in the script works as desired but I get the error
CS1061: ‘Node3D’ does not contain a definition for ‘get_global_rotation’ and no accessible extension method ‘get_global_rotation’ accepting a first argument of type ‘Node3D’ could be found (are you missing a using directive or an assembly reference?) G:\Godot Projects\TGWYJST\Player Scripts\movement.cs(23,8)
but the Godot documentation says that this (and set_global_rotation()) are commands that a Node3D should be fine with. I have no clue why this is not working, what am I missing?
In GDScript, the setters/getters of a property can be called directly, although this is not encouraged. In C#, only the property is defined. For example, to translate the GDScript code x.set_name(“Friend”) to C#, write x.Name = “Friend”;.
Just out of curiosity, do you (or anyone else) know why using setters/getters is “not encouraged” ?
They’re actually more performant than just doing x.Name = “Friend”.
They’re actually more performant than just doing x.Name = “Friend”.
What are you basing this on? The properties should be correctly compiled into the specific method, but either way I’d say any difference would be marginal, and would only apply for built-in properties
for script properties without explicit get/set methods you’d have better performance as the internal code accesses the properties as properties, AFAIK
My own testing + I’ve seen others mention it somewhere (probably on these forums, but can’t find it now).
Yeah I meant built-in properties, and sure, it’s not a huge difference, but I started using setters/getters more when I found out and this is the first time I see that they’re not encouraged. I’m just wondering why.