# How to prevent the objects from going through the floor?

I have a cube and a plane in an inactive layer. I copy them to another layer by using addObject and change their vertices by setXYZ. The plane is static and the cube is a rigidObject. When I start the simulation the cube goes through the plane, while it should not happen since the cube is shown right on top of the plane. Could someone let me know what I am doing wrong? Below is part of the code that I wrote. I wrote it in a way that it runs just once and it doesn't add a cube and plane at every cycle of bge (I removed those parts below):

tmpobj = scene.addObject("Cube", "Empty", 0)
tmpobj.worldPosition = box_world # box_world is a variable that specifies where the cube should move to in the active layer.
mesh = tmpobj.meshes[0]
nvert = mesh.getVertexArrayLength(0)

cc = 0
for j in range(nvert):
vert = mesh.getVertex(0, j)
vert.setXYZ(box[cc:cc+3]) # box is a 1x72 array that contains the new coordinates of the box
cc = cc + 3

tmpobj2.worldPosition = floor_world # floor_world is a variable that contains the world position of the plane in the active layer

mesh = tmpobj2.meshes[0]
nvert = mesh.getVertexArrayLength(0)
for j in range(nvert):
vert = mesh.getVertex(0, j)
vert.setXYZ(floorcorners) # floorcorner is a variable that contains the coordinates of the floor plane

• You need to set up physics properties at your Cube as Ridgid Body or Dynamic and at Plane as Static so that they can interact... – Samoth Apr 16 '16 at 9:12