It sounds like such a simple task but I cannot figure out the solution.
I have a physics ball (player) and several wall models. All I am trying to achieve is to make the wall models "solid" to the player. I have them created, and I have them moving with c_move, but when the player collides with them, it just passes straight through. One is an elevator, so when the player collides, it starts moving upwards on the z axis and the ball should stay on top of it.
Here is the code I am using for my wall models
function square()
{
my.x = tl_x;
my.y = tl_y;
my.roll = 90;
var gridLocRow = integer(random(4));
var gridLocCol = integer(random(4));
if(gridLocRow == 0)
my.x = tl_x;
else if(gridLocRow > 0)
my.x += gridLocRow * gridInc;
if(gridLocCol == 0)
my.y = tl_y;
else if(gridLocCol > 0)
my.y -= gridLocCol * gridInc;
while(my.z < 0)
{
//my.z -= 5 * time_step;
c_move(me, nullvector, vector(0,0,5*time_step), GLIDE|IGNORE_MAPS|IGNORE_WORLD|USE_POLYGON);
if(hit.entity == player) // just to test if collision is working
{
freeze_mode = 1;
}
if(my.z < 2 && my.z> 0)
beep();
wait(1);
}
ent_remove(me);
}