Parents

As you can see, parents are important in KapEngine. This functionnality allow you to move / rescale / rotate several GameObject in same time.

It's useful to make a clean project too.

To set the parent you can do this :

auto child = scene.createGameObject("My Child");
auto parent = scene.createGameObject("My Parent");

//first solution
child.setParent(parent);
//second solution
child.setParent(parent->getId());

Other Functions

  • allParentIsActive() : give you true if all parents are active or false if one of parents are disable

  • getParentEntity() : Give you the parent Entity class

  • getParent() : Give the shared_ptr<GameObject> of parent

  • parentContainsComponent(nameComponent, recurcibely) : allow you to know if a parent contain a specific component. "recurcively" is an argument that do this function on all parents.

  • parentContainsComponent(vector<string> names, recurcibely) : like above function but with several components

  • getParentContainsComponent(componentName) : give you the parent id that contain a specific component. If no component found : return 0.

  • allParentsActive() : same as allParentIsActive but it is a const function

Last updated