I have done the same thing essentially. But I have written inside the action of the model

action asd() {
// ball drops to floor;
my.x= x1; my.y =y1; my.z =z1;
// code for placement at x1,y1,z1
}

But I dont see it working.Is anything wrong ? Should I put this only inside a function ?