I am trying to create a multi-part object for my game. However, I’m having issues sending messages to the child objects. I’ve created a minimal reproduction project attached below (based on the RenderCam example project to save time, although the issue has nothing to do w/ RenderCam.) When I try to send the message hash(“set_parent”) to each of the child objects, the instance can not be found, even though the error message prints what looks to be the correct path to the instanced object script. Please if anyone can explain how to do this I’d be most grateful!
EDIT: As a note, the errors appear like this:
ERROR:GAMEOBJECT: Instance '/collection0/go/a' could not be found when dispatching message 'set_parent' sent from main:/collection0/go#go
ERROR:GAMEOBJECT: Instance '/collection0/go/b' could not be found when dispatching message 'set_parent' sent from main:/collection0/go#go
However, if I manually pre-pend “main:” prior to the path then I get another error:
ERROR:SCRIPT: /main/multipartobject/multipartobject.script:28: bad argument #1 to 'post' (url expected, got string)
stack traceback:
[C]: in function 'post'
/main/multipartobject/multipartobject.script:28: in function </main/multipartobject/multipartobject.script:11>
What I’m giving it before is a string but is recognized as a path (however, not the correct one.) If I include the main: prefix then it complains that it’s a string and not a path… Essentially my question boils down to, how can I properly get the path of a sub-object w/in a collection from a master script?
EDIT2: To explain why I’m doing this: I want to represent an enemy in my game as multiple objects. However, I want to receive each physics based message in relation to the part of the enemy which is damaged. Depending on which part receives the message, different logic must occur.
EDIT3: As an example from my own game (which uses the same structure:) It seems msg.post attempts to convert the input string using msg.url(string) to convert. I can attempt to pre-convert to url using msg.url like the following: msg.url(collection_root … “go/ss_enemy#go”). I then print this and it displays: DEBUG:SCRIPT: url: [main:/collection3/go/ss_enemy#go] However, when I run it, I get: ERROR:GAMEOBJECT: Instance ‘/collection3/go/ss_enemy’ could not be found when dispatching message ‘set_parent’ sent from main:/collection3/ss_enemy#go