Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (OptimusPrime, AndrewAMD), 14,580 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Einfaches Physikobjekt erstellen #29816
07/02/04 23:12
07/02/04 23:12
Joined: May 2004
Posts: 6
G
Glibos Offline OP
Newbie
Glibos  Offline OP
Newbie
G

Joined: May 2004
Posts: 6
Hallo,
könnte mir jemand mal ne Beispiel action für ein Pysikobjekt geben?
Könnt ihr wenn bitte zu den Parametern mal Kommentare schreiben? Ich versuche nämlich diese Physik zu verstehen. Könnt ihr mal mit einem beweglichen Würfel anfangen, der wenn er auf andere Würfel trifft sich bewegt?

mfg
Glibos

Re: Einfaches Physikobjekt erstellen [Re: Glibos] #29817
07/03/04 05:18
07/03/04 05:18
Joined: Sep 2003
Posts: 3,236
San Diego, CA
M
Marco_Grubert Offline
Expert
Marco_Grubert  Offline
Expert
M

Joined: Sep 2003
Posts: 3,236
San Diego, CA

Re: Einfaches Physikobjekt erstellen [Re: Marco_Grubert] #29818
07/03/04 21:08
07/03/04 21:08
Joined: May 2004
Posts: 6
G
Glibos Offline OP
Newbie
Glibos  Offline OP
Newbie
G

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_ Offline
Member
zSteam_  Offline
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
Re: Einfaches Physikobjekt erstellen [Re: Glibos] #29820
07/09/04 21:25
07/09/04 21:25
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
normalerweise sollte dein physics-objekt ganz automatisch auf entities die ent_move oder c_move verwenden reagieren. das tun sie bei mir. vielleicht sind deine objekte zu schwer?


Moderated by  HeelX, Spirit 

Gamestudio download | 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