OK, #godot question.
-
OK, #godot question. I think this was a recent change, I remember it working before.
Since all Godot scripts are layered on top of a node type, it's quite possible to assign a script that descends from "Node3D" to a more specific node - say, "RigidBody3D".
I want to say "if self is RigidBody3D:" and have logic.
However, Godot IMMEDIATELY red-flags it. As a parse error. A PARSE ERROR?! It parses fine, what a whiner.
Anyway, how do I do it?
-
OK, #godot question. I think this was a recent change, I remember it working before.
Since all Godot scripts are layered on top of a node type, it's quite possible to assign a script that descends from "Node3D" to a more specific node - say, "RigidBody3D".
I want to say "if self is RigidBody3D:" and have logic.
However, Godot IMMEDIATELY red-flags it. As a parse error. A PARSE ERROR?! It parses fine, what a whiner.
Anyway, how do I do it?
This wouldn't be an issue if Godot had interfaces and I could have Array[ControlInterfaces].
-
This wouldn't be an issue if Godot had interfaces and I could have Array[ControlInterfaces].
It is unimaginably stupid, but the only workaround I could find was to have an "export var body:RigidBody3D" and then assign it ITSELF in the inspector.
Can't even assign it in code, not using the techniques I know.
This is sad.
-
OK, #godot question. I think this was a recent change, I remember it working before.
Since all Godot scripts are layered on top of a node type, it's quite possible to assign a script that descends from "Node3D" to a more specific node - say, "RigidBody3D".
I want to say "if self is RigidBody3D:" and have logic.
However, Godot IMMEDIATELY red-flags it. As a parse error. A PARSE ERROR?! It parses fine, what a whiner.
Anyway, how do I do it?
@Craigp Not a gdscript user but I went looking on their issue tracker. This doesn't quite sound like your problem https://github.com/godotengine/godot/issues/73722 but maybe trying is_instance_of() could be a resolution.
more recent PR https://github.com/godotengine/godot/pull/113228 seems to have extended the kind of type checks that can be verified statically to be impossible. Are you sure that an object of type ControlsSubmarine can also be a RigidBody3D, or is it telling you that the body of the if-statement really could never be used?
I think your current workaround is preventing the static check, which if I understand is_instance_of() will also do.
-
@Craigp Not a gdscript user but I went looking on their issue tracker. This doesn't quite sound like your problem https://github.com/godotengine/godot/issues/73722 but maybe trying is_instance_of() could be a resolution.
more recent PR https://github.com/godotengine/godot/pull/113228 seems to have extended the kind of type checks that can be verified statically to be impossible. Are you sure that an object of type ControlsSubmarine can also be a RigidBody3D, or is it telling you that the body of the if-statement really could never be used?
I think your current workaround is preventing the static check, which if I understand is_instance_of() will also do.
@stylus Ahah, you are 100% right, that works fine.
Maybe that should be part of the "fatal parser error because it will return null and that apparently is a fatal parser error" message.
-
undefined oblomov@sociale.network shared this topic on
Feed RSS
Gli ultimi otto messaggi ricevuti dalla Federazione
Post suggeriti
-
Ok, #godot heads, I need a ProgressBar that contains and arbitrary number of "bricks".
Uncategorized
1
-
Screen-space reflections are pretty neat!#GameDev #IndieDev #IndieGame #GodotEngine #Godot
Uncategorized
1
-
-
I've been working my through the Godot Shader Bible, which I purchased a little while back.
Uncategorized
1
