Hello Everybody,
I asked 4 months ago about this but I didn't get any response, so hopefully this time somebody help me ...

I made an elevator as a physics kinematic object... I used pXent_kinematic ( entity, var active );
and moved it using pXent_moveglobal ( entity, VECTOR* vMove, ANGLE* aRotate);
However, the physics player (pXent_movechar )doesn't move up and down or sideways with the moving elevator if I keep the player standing on it (( The elevator gets through the body of the player)) but If I walk or run on the elevator while it is moving up then everything works fine and the player moves up... ...
When I don't use physics I can solve it by making the player.z = elevator.z+100; but now I can't use xyz to move the player cuz I am using physics...
and I am using :
pX_setccd ( 1 ); in my main function and pXent_setccdskeleton(my, nullvector, 1); in my actions...

I even asked JCL and he said that "solutions are the same as for non-physics, just with pXent_movechar instead of c_move."
However, in non physics codes that can be found in AUM, George changes my.z but here it's a physics entity that can't be moved using my.z


Here's a code taken from AUM >>>

Quote:
///////////////////////////////
#include <acknex.h>
#include <default.c>

///////////////////////////////


ENTITY* lift1;



action players_code() // attach this action to your player

{
player = my; // I'm the player
while (!lift1) {wait (1);} // wait until the lift entity is loaded
var movement_speed = 20; // movement speed
var distance_to_ground;
VECTOR temp;
set (my, INVISIBLE); // 1st person player
while (1)
{
my.pan -= 7 * mouse_force.x * time_step;
camera.x = my.x;
camera.y = my.y;
camera.z = my.z + 50 + 1.1 * sin(my.skill44); // play with 50 and 1.1
camera.pan = my.pan;
camera.tilt += 5 * mouse_force.y * time_step;
vec_set (temp.x, my.x); // trace 10,000 quants below the player
temp.z -= 10000;
distance_to_ground = c_trace (my.x, temp.x, IGNORE_ME | IGNORE_PASSABLE | SCAN_TEXTURE);
// replace "elevator1" with the name of the texture that is used by your lift
if (str_cmpi(tex_name, "elevator1")) // the player is using the lift?
{
my.z = lift1.z + 100; // play with 100
}
else // the player isn't using the lift? Then keep its feet on the ground
{
temp.z = -distance_to_ground + 20; // play with 20
}
temp.x = movement_speed * (key_w - key_s) * time_step;
temp.y = movement_speed * (key_a - key_d) * 0.6 * time_step;
c_move (my, temp.x, nullvector, IGNORE_PASSABLE | GLIDE);
wait (1);
}
}



action my_lift() // attach this action to your lift
{
lift1 = my;
while (!player) {wait (1);} // wait until the player entity is loaded
var init_z;
var max_height = 200; // the lift can move upwards for up to 200 quants
init_z = my.z; // store the initial height of the lift
while (1)
{
while (my.z < init_z + max_height)
{
my.z += 5 * time_step;
wait (1);
}
wait (-3); // wait 3 seconds at the top
while (my.z > init_z)
{
my.z -= 5 * time_step;
wait (1);
}
wait (-5); // wait 5 seconds at the bottom
}
}







Is there any way I can convert it to physics?

Last edited by bk9iq; 11/25/10 05:56.