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?
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.Sign up to join this community
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.