I have two objects
A a box
B a sphere.
I want to make B A's child.
how can this be done in the BGE, using python?
import bge cont = bge.logic.getCurrentController() own = cont.owner scene = own.scene objA = scene.objects["objA"] objB = scene.objects["objB"] objB.setParent(objA)
Sets this object’s parent. Control the shape status with the optional compound and ghost parameters. In that case you can control if it should be ghost or not.
parent (KX_GameObject) – new parent object.
compound (boolean) – whether the shape should be added to the parent compound shape.
True: the object shape should be added to the parent compound shape.
False: the object should keep its individual shape.
ghost (boolean) – whether the object should be ghost while parented.
True: if the object should be made ghost while parented.
False: if the object should be solid while parented.