Game Object: removeParent

removeParent()
  • Removes the parent.
Note:
  • Removes the parent added in game.  Game objects parented using setParent(parent, compound, ghost)
Sample Code

################### Remove the game object's parent
  

# import bge
import bge

# get controller
cont = bge.logic.getCurrentController()

# get object that controller is attached to
obj = cont.owner

# object is a child.  Remove the parent
obj.removeParent()