Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by dr_panther. 05/18/24 11:01
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (7th_zorro, dr_panther), 724 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Physics and Elevators #348337
11/25/10 05:49
11/25/10 05:49
Joined: Jul 2010
Posts: 129
B
bk9iq Offline OP
Member
bk9iq  Offline OP
Member
B

Joined: Jul 2010
Posts: 129
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.
Re: Physics and Elevators [Re: bk9iq] #348338
11/25/10 06:12
11/25/10 06:12
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
I didn't try to work with PhysX yet, but I can help you to make elevators with C_MOVE. If you'll need help. PM me.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Physics and Elevators [Re: 3run] #348343
11/25/10 09:21
11/25/10 09:21
Joined: Oct 2009
Posts: 149
Germany
M
muffel Offline
Member
muffel  Offline
Member
M

Joined: Oct 2009
Posts: 149
Germany
Create a dummy Entitie above or under your lift. Register it to physic don't know wich mode, but you should be able to create constraints with these Ent and it shouldn't be affected by gravity.
Register your lift platform as a Physikobject and then conect them with a PH_Slider.
To move the platform up and down add velocities/Forces

muffel


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1