Parenting objects

From what I can tell, WADE doesn't have a built-in way to create container objects, i.e. to parent one SceneObject to another.

For example, if I wanted to essentially group a collection of SceneObjects, where when I move the parent, all the child SceneObjects move as well, relative to their given offset.

In this sense, this would be similar to how SceneObjects already are able to have multiple Sprite components which follow the SceneObject. Except, instead of (or in addition to) Sprites, you could use SceneObjects as children of the SceneObject.

Does this make sense? Is there already some kind of feature like this that I am missing? 

Thank you!

All 5 Comments


You're right, there isn't a built-in way to do that and this is something that I've though about adding too... but I'm not sure how it would work in practice. It'd be good to know what you and other people here think, maybe we can find a sensible way to make it work.

The advantage of having Sprites that are distinct entities to SceneObjects, and SceneObjects that contain sprites, is that it's clear what each entity does: a Sprite is used to draw a shape, a SceneObject controls how one or more sprites behave in the scene.

If we have SceneObjects that are controlled by their parents, but can also be controlled directly, it gets a bit confusing. Say that I move the parent scene objects to position A, while I move a child object to position B - what should be the expected behavior of the child object? Should it ignore what its parent says, or should it ignore that we're telling it to go to position B? If it doesn't ignore either, it gets stuck in a loop, being pushed towards two different target positions at the same time.

Any opinions are welcome.


Yeah, finding a good solution could be tricky.

Just thinking onto text here, but here's some things that come to mind:

  • SceneObjects can have a parent property (similar to owner property of behaviors), which is null if not a child of another SceneObject.
  • Similar to Sprite components, the relative position of these child SceneObjects can be dictated by offset properties.
  • When moving a child SceneObject with setPosition, it moves the child object but not the parent. This is done by simply automatically updating the offset properties. For example, if the parent is at 0,0, and the child at 0, 100, then the child's offset is 0, 100. If a setPosition of 0, 300 is called on the child, then the parent stays at 0, 0, but the child's offset is set to 0, 300, if this makes sense.
  • Instead of adding onto the Sprites (or what could instead be Components) tab, perhaps the easiest way to create parent-child relationships would be to drag a SceneObject in the scene outliner panel (on the left), over another SceneObject. To visually indicate this relationship, the child object could appear "tabbed" from underneath the parent. Adding this kind of system so that it is intuitive can require a bit of fine-tuning, so I understand if you'd rather do a more explicit method of parenting (such as with supplying SceneObject name references in a combined Sprites/SceneObjects "Components" tab).
  • Maybe a child object's offset is set by default to the offset of the object as they appear in the editor.
  • Moving the parent in the editor (and at run-time, of course) also moves the children based on their offsets.
  • Cloning a parent clones the children too. Adding a parent scene object with wade.addSceneObject adds the children too.
  • To add a new child to a SceneObject could be done with SceneObject.addSceneObject.
  • If you attempt to add a SceneObject to another SceneObject, but the child object is already the child of another SceneObject, then it just removes it as a child of the old SceneObject and makes it a child of the new one. This can maybe be done in engine by changing the parent property reference of the child (among other things).

I'm probably leaving out important elements, but I don't want to waste too much time if this isn't the direction you think this should be taken.


Hi Wade team!

I often find a way around to make up for the missing parenting/grouping functionnality.

But it would really be appreciated to have a simple form of sceneObject grouping.
I was kind of use to this in HTML5 game dev with Haxe/Flambe and Unity.

Thanks a lot. 





This has come up a few times now, so I think it's time we did something about it :)

The way I see it, we have two options:

1. You can link scene objects to other scene objects. The syntax would be similar to this:


Whenever object b moves, object a follows it. The same applies to rotation.

2. We add a new class that something like a SceneObjectGroup. You can create one of these and add objects to it, and this is what would be returned by wade.getSceneObjects(....) (instead of returning an array as it does now), wade.getObjectsInArea(), etc. You can then call some functions like setPosition, setVelocity, setRotation, etc. on the SceneObjectGroup itself. So it would look like this:

var myObjects = wade.getSceneObjects('someProperty', 'someValue');
myObjects.moveTo(123, 456, 78);


var myObjects = new SceneObjectGroup();
myObjects.setVelocity(100, 200);

It would be good to know which one people think is better. We might be able to do this for version 4.0.


Wow thanks Gio!

I think that the second approach is more complete and would really fill the gap.


Post a reply
Add Attachment
Submit Reply
Login to Reply