Weird blender game engine python problem I was trying to create the illusion of a building being destroyed as soon as there is a collision using python. Everything seems to work fine when I use a cube, but it breaks as soon as I use the real building

I have attached a simple version of the problem which illustrates both the cube and the building. Whenever the "player" cube collides with the red cube, the addobject works perfectly. The same thing done with a building produces weird results. (Note they have the exact same settings and they both use the same python module)

Can someone please help me resolve this mystery. I have been cracking my head for ever. Here's the blend file
(Use the arrow keys to move the player cube and collide it with different objects)
https://www.dropbox.com/s/q3gajcxasv1c2dt/break_demo.blend?dl=0

ANSWER:

If anybody is stuck with a similar problem, then look into scaling. Here's my final code to get it done without using any empty's and rescaling in fly

def decimate(cont):
    self = cont.owner
    scene = self.scene
    self.scaling = [1,1,1]
    scene.addObject(placer_ID, self)
    self.endObject()


Also if it seems that the object gets added, but at the wrong location. Then it is due to the fact that the origin is not set. Try to set the origin to center of geometry or center of mass (Ctrl + Shift + Alt + C). You have to set this by selecting the empty associated with the group. Look at this question for more details Replace objects with a group of objects using Python
There is one notable difference between the cube and the building -> The cube has a unit scale (1, 1, 1), but the building is scaled down. Since spawned objects adopt the local scale of the spawner, the behavior you observe, while not desired, is perfectly normal.

To get desired behavior, you need to specify a spawner object (typically an empty) with a unit scale, and use that to spawn the relevant group.

So, the script would now look like this:

def decimate(cont):
    self = cont.owner
    scene = self.scene
    spawner = scene.objects["Spawner"]
    spawner.worldPosition = self.worldPosition
    spawner.worldOrientation = self.worldOrientation
    scene.addObject("cube_parts", spawner)
    self.endObject()


Demo: break_demo_spawner.blend