2 registered members (OptimusPrime, AndrewAMD),
14,580
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Einfaches Physikobjekt erstellen
[Re: Marco_Grubert]
#29818
07/03/04 21:08
07/03/04 21:08
|
Joined: May 2004
Posts: 6
Glibos
OP
Newbie
|
OP
Newbie
Joined: May 2004
Posts: 6
|
Also, das mit dem Physikobjekt hat geklappt, aber wie mache ich das, dass das Physikobjekt mit dem Player und mit dem Geschoss agiert? Mein Playerscript: Code:
action player1 { player = my; my.invisible = on; // hide the player model my.light = 1; my.lightrange = 0; while (1) { vec_set (camera.pos, my.pos); camera.pan = my.pan; camera.tilt += 10 * mouse_force.y * time; my.pan -= 10 * mouse_force.x * time; temp.x = 10 * (key_w - key_s) * time; temp.y = 5 * (key_a - key_d) * time; temp.z = 0; ent_move (temp, nullvector); wait (1); }
} Mein Bulletscript: Code:
function fire_bullet() { ent_create (bullet_mdl, camera.x, move_bullet); }
function move_bullet() { my.unlit = on; my.enable_block = on; // the bullet is sensitive to level blocks my.enable_entity = on; // and entities my.enable_impact = on; my.pan = camera.pan; my.tilt = camera.tilt; my.event = remove_bullet; while(1) { if (vec_dist (my.x, camera.x) < 50) { my.passable = on; } else { my.passable = off; } temp.x = 30 * time; temp.y = 0; temp.z = 0; move_mode = ignore_you + ignore_passable + glide; ent_move (temp, nullvector); wait(1); } }
function remove_bullet() { wait (1); ent_remove(me); } Mein Physikobjektscript: Code:
action ball1 { my.light = on; my.transparent = on; my.alpha = 75; my.lightrange = 100; my.green = 0; my.red = 10; my.blue = 0; phent_settype(my, ph_rigid, ph_sphere); // enable physics for this ball phent_setmass(my, 1, ph_sphere); // the ball has 1kg (2 lbs) and behaves like a sphere phent_setfriction(my, 30); // friction phent_setelasticity(my, 30, 0); // bounce a little temp.x = 0; temp.y = 0; temp.z = -380; // earth gravity factor, g = 9.81 m/s2 ph_SetGravity(temp); // set gravity while (my.z > -150) {wait (1);} // the ball has approached the floor sleep (3); // give it 3 more seconds phent_setelasticity(my, 0, 0); // stop bouncing sleep (3); // give it 3 more seconds phent_settype(my, 0, ph_sphere); // now stop the ball } Könnt ihr mir helfen? mfg Glibos
|
|
|
Re: Einfaches Physikobjekt erstellen
[Re: Glibos]
#29819
07/08/04 23:51
07/08/04 23:51
|
Joined: Mar 2004
Posts: 202 Germany
zSteam_
Member
|
Member
Joined: Mar 2004
Posts: 202
Germany
|
Hi ich hab mir nen skript zusammen gebastelt aber ich hab noch ein Problem der fällt vor mir einfach herunter ohne das er nach von geschleudert wird
var weg; var tumblespeed[3] = 10,0,0; var drop_dist = 0; var max_lights = 3; SOUND bumm = <bumm.wav>;
function fire_bullet() { while (drop_dist != 0) { wait(1); } drop_dist = 60; p = drop_dist; set_pos_ahead(); ent_create (bullet_mdl, MY_POS, move_physik); //waitt(1); drop_dist = 0; }
function move_physik() { var mySpeed[3]; var earthgravity[3] = 0,0, -386; var jupiterGravity[3]; ph_setgravity( earthgravity ); vec_set( jupiterGravity, earthGravity ); vec_scale( jupiterGravity, 2.5 ); ph_setgravity( jupiterGravity ); phent_settype (my, ph_rigid, ph_poly); phent_setmass (my, 10, ph_sphere); phent_setfriction(my, 30); // friction phent_setelasticity(my, 95, 0); // bounce a little } function fire_bullet2() { while (drop_dist != 0) { wait(1); } drop_dist = 60; p = drop_dist; set_pos_ahead(); ent_create (ball_mdl, MY_POS, move_bullet2); //waitt(1); drop_dist = 0; }
function move_physik2() { var mySpeed[3]; var earthgravity[3] = 0,0, -386; var jupiterGravity[3]; ph_setgravity( earthgravity ); ph_setgravity( nullvector ); vec_set( jupiterGravity, earthGravity ); vec_scale( jupiterGravity, 2.5 ); ph_setgravity( jupiterGravity ); phent_settype (my, ph_rigid, ph_poly); phent_setmass (my, 100, ph_sphere); phent_setfriction(my, 100); // friction phent_setelasticity(my, 0, 0); // bounce a little }
var Light_on; ON_CTRL set_light;
FUNCTION set_light () { IF (Light_on == 0) { Light_on = 1; vec_set(mat_model.ambient_red,vector(255,0,0)); vec_set(mat_model.ambient_green,vector(255,0,0)); vec_set(mat_model.ambient_blue,vector(255,0,0)); } ELSE { Light_on = 0; vec_set(mat_model.ambient_red,vector(0,0,0)); vec_set(mat_model.ambient_green,vector(0,0,0)); vec_set(mat_model.ambient_blue,vector(0,0,0));} }
function move_bullet() { move_physik(); my.pan = camera.pan; // let it fly in view direction, like a bullet my.roll = camera.roll; my.tilt = camera.tilt; // my.event = move_physik; my.enable_block = on; my.enable_entity = on; /////////////////////////////////////////////////////////////////// while (1) { move_mode = ignore_you;
temp.x = 30 * time; temp.y = 0; temp.z = 0; ent_move(temp,nullvector);
//ent_move(tumblespeed,nullvector); // loop the entity sound //ifndef SERVER; // snd_playing does not work on the server because sounds play on the client // if (snd_playing(my.skill10) == 0) { // my.skill10 = ent_playsound(my,whosh,200); // } //endif; // change the lights my.red += 4*time; my.green += 3*time; my.blue += time; // use the modulo function to cycle colors from 0..255 my.red %= 256; my.green %= 256; my.blue %= 256;
wait(1); } } }
function move_bullet2() { move_physik(); my.pan = camera.pan; // let it fly in view direction, like a bullet my.roll = camera.roll; my.tilt = camera.tilt; // my.event = move_physik2; my.enable_block = on; my.enable_entity = on; /////////////////////////////////////////////////////////////////// while (1) { move_mode = ignore_you;
temp.x = 30 * time; temp.y = 0; temp.z = 0; ent_move(temp,nullvector);
//ent_move(tumblespeed,nullvector); // loop the entity sound //ifndef SERVER; // snd_playing does not work on the server because sounds play on the client // if (snd_playing(my.skill10) == 0) { // my.skill10 = ent_playsound(my,whosh,200); // } //endif; // change the lights my.red += 4*time; my.green += 3*time; my.blue += time; // use the modulo function to cycle colors from 0..255 my.red %= 256; my.green %= 256; my.blue %= 256;
wait(1); } phent_settype(my, ph_rigid, ph_sphere); // enable physics for this ball phent_setmass(my, 10, ph_sphere); // the ball has 1kg (2 lbs) and behaves like a sphere phent_setfriction(my, 30); // friction phent_setelasticity(my, 99, 0); // bounce a little temp.x = 0; temp.y = 0; temp.z = -380; // earth gravity factor, g = 9.81 m/s2 ph_SetGravity(temp); // set gravity //while (my.z > -150) {wait (1);} // the ball has approached the floor //sleep (3); // give it 3 more seconds //phent_setelasticity(my, 0, 0); // stop bouncing //sleep (3); // give it 3 more seconds //phent_settype(my, 0, ph_sphere); // now stop the ball camera.x = 30; weg.x = 0; weg.y = 0; weg.z = 50; //temp.x = 30;// * time; //temp.y = 0; //temp.z = 0; } } function move_bulle() { my.unlit = on; my.enable_block = on; // the bullet is sensitive to level blocks my.enable_entity = on; // and entities my.enable_impact = on; my.pan = camera.pan; my.tilt = camera.tilt; my.event = move_physik; while(1) { if (vec_dist (my.x, camera.x) < 50) { my.passable = on; } else { my.passable = off; } temp.x = 30 * time; temp.y = 0; temp.z = 0; move_mode = ignore_you + ignore_passable + glide; ent_move (temp, nullvector); wait(1); } }
function remove_bullet() { //wait (1); //ent_remove(me); phent_settype(my, ph_rigid, ph_sphere); // enable physics for this ball phent_setmass(my, 100, ph_sphere); // the ball has 1kg (2 lbs) and behaves like a sphere phent_setfriction(my, 30); // friction phent_setelasticity(my, 96, 0); // bounce a little temp.x = 0; temp.y = 0; temp.z = -380; // earth gravity factor, g = 9.81 m/s2 ph_SetGravity(temp); // set gravity }
action ball1 { phent_settype(my, ph_rigid, ph_sphere); // enable physics for this ball phent_setmass(my, 100, ph_sphere); // the ball has 1kg (2 lbs) and behaves like a sphere phent_setfriction(my, 75); // friction phent_setelasticity(my, 99, 0); // bounce a little temp.x = 0; temp.y = 0; temp.z = -380; // earth gravity factor, g = 9.81 m/s2 ph_SetGravity(temp); // set gravity //while (my.z > -150) {wait (1);} // the ball has approached the floor //sleep (3); // give it 3 more seconds //phent_setelasticity(my, 0, 0); // stop bouncing //sleep (3); // give it 3 more seconds //phent_settype(my, 0, ph_sphere); // now stop the ball } }
on_mouse_left = fire_bullet; on_mouse_right = fire_bullet2;
A6 Commercial 6.50.6
|
|
|
|