Add sub-nodes via class? #10
insomniacUNDERSCORElemon
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Does all-in-code mean that we do not use textscene (tscn) or other resource types? At least for the examples given (like door and cylinder, or button and plate), although it should be using Skeleton3D, but it would be useful as a demonstration that it is feasible. I cannot present a conceptual implementation for this, but I can show a way to do it simply: type MyDoor* = ref object of CollisionObject3D
method ready (self: MyDoor) {.gdsync.} =
var cylinder = instantiate Cylinder
cylinder.name = "cylinder"
cylinder.basis = ...
self.addChild cylinder |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am the first to say that using the editor is easier (and I probably should do that now) but I've been thinking that it would be neat to create nodes in a class (all in code) particularly for simple setups. Additionally, this would allow using exported data for node structure rather than needing multiple instanced scenes (the downside to all-code being that the ready function would need to run in the editor/as a tool script in 3.2, at least to display anything other than a placeholder).
I am particularly thinking doors with this (sci-fi/elevator doors, or the same thing but with multiple cylinders as the visual for a locked/dungeon look). Though mentioning the exported data for different types also makes me think of other interactables like barrels or switches that have often have variants with different implementations.
While some of this is also related to how classes show up now (which encourages re-using classes), more code just for a slightly different workflow obviously makes more sense for a library/plugin or shared code snippets etc. than it does for most projects. Though all-code seems like it's a thing with dungeon crawlers, so would be a good thing to have an example of somewhere
Beta Was this translation helpful? Give feedback.
All reactions