Skip to content

How can I act on an instance reference ? #27

Answered by Splizard
jugglingjsons asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks, looks like you have found a bit of an issue here, as you need the node to be alive in Go in order to get the nodepath, I've added a function to gd (gd.AddChild) that will workaround this, it will add the child and return the resulting NodePath (I've tested this and it looks like the rigid bodies are moving now).

You can replace

m.Super().AddChild(instance)
fmt.Println(instance.GetPath())
m.boidsGD = append(m.boidsGD,instance.GetPath())

with

m.boidsGD = append(m.boidsGD, m.Super().AsNode().AddChild(mob.AsNode()))

Big thanks for reporting your experience here, it really helps us to identify the pain points and areas to improve our Go integration with Godot!

Replies: 1 comment 11 replies

Comment options

You must be logged in to vote
11 replies
@jugglingjsons
Comment options

@Splizard
Comment options

Answer selected by jugglingjsons
@jugglingjsons
Comment options

@Splizard
Comment options

@jugglingjsons
Comment options

@jugglingjsons
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants