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
3 registered members (AndrewAMD, Ayumi, NewbieZorro), 14,141 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
return force?? #24930
04/02/04 04:03
04/02/04 04:03
Joined: Mar 2004
Posts: 70
M
Matan_Golan_A6 Offline OP
Junior Member
Matan_Golan_A6  Offline OP
Junior Member
M

Joined: Mar 2004
Posts: 70
why when ball1 hit another ball2
ball2 move by the force but ball1 dont get return force (elastic)

p.s
i defined the elasticy force to 50...
and still nothing

should i use the old way like


var min_dist_between_balls = 10;
var dist_between_balls;

dist_between_balls = ball1.x - ball2.x;
if (dist_between_balls <= min_dist_between_bals)
{
phent_addcentralforce(ball1, lunchpower);
}

this will work??

Re: return force?? [Re: Matan_Golan_A6] #24931
04/02/04 04:21
04/02/04 04:21
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
Newton's Third works fine for me.
Check that your Drag and Friction values aren't high. My guess is that ent1 has no D or f, while ent2 has alot of D and f.
Check that ent2 is also registered with the PE. If you have anything but PRO, you are only allowed one registered entity.

Either your physical parameters aren't set correctly or you don't have PRO.
Other than that, I dan't see why it shouldn't work

Re: return force?? [Re: fastlane69] #24932
04/03/04 03:19
04/03/04 03:19
Joined: Mar 2004
Posts: 70
M
Matan_Golan_A6 Offline OP
Junior Member
Matan_Golan_A6  Offline OP
Junior Member
M

Joined: Mar 2004
Posts: 70
OH i have Pro...
and ive reg my entities
all the balls have same drag and firction(and mass)

p.s but if the ball hit a wall or bound the N force is applied
maybe it will need a colison detection code for balls?

edit:
here is my code
(Key_u) is insted of the aiming and power code i just want to test it first.

Code:

entity* cueball;
entity* 1ball;
entity* 2ball;
entity* 3ball;
entity* 4ball;
entity* 5ball;
entity* 6ball;
entity* 7ball;
entity* 8ball;
entity* 9ball;
entity* 10ball;
entity* 11ball;
entity* 12ball;
entity* 13ball;
entity* 14ball;
entity* 15ball;

bmap cueballb = <1cue.pcx>;
bmap 1ballb = <1.pcx>;
bmap 2ballb = <2.pcx>;
bmap 3ballb = <3.pcx>;
bmap 4ballb = <4.pcx>;
bmap 5ballb = <5.pcx>;
bmap 6ballb = <6.pcx>;
bmap 7ballb = <7.pcx>;
bmap 8ballb = <8.pcx>;
bmap 9ballb = <9.pcx>;
bmap 10ballb = <10.pcx>;
bmap 11ballb = <11.pcx>;
bmap 12ballb = <12.pcx>;
bmap 13ballb = <13.pcx>;
bmap 14ballb = <14.pcx>;
bmap 15ballb = <15.pcx>;

material cueballm
{
skin4 = cueballb;
}


function setup_balls()
{
//starting setup balls pos!
//cueball:
var cueballsetup[3] = -368, -32, -448;
var cueskin = 3;
cueball = ent_create (mdlb, cueballsetup, NULL);
cueball.skin = cueskin;
cueball.metal = ON;
cueball.albedo = 70;
cueball.ambient =20;
//cueball.material = cueballm;
//1st ball:
var 1ballsetup[3] = 192, -32, -448;
1ball = ent_create (mdlb, 1ballsetup, NULL);
1ball.metal = ON;
1ball.albedo = 70;
1ball.ambient =20;
//2nd ball:
var 2ballsetup[3] = 224, -48, -448;
2ball = ent_create (mdlb, 2ballsetup, NULL);
2ball.metal = on;
2ball.albedo = 70;
2ball.ambient = 20;
//3rd ball:
var 3ballsetup[3] = 224, -16 , -448;
3ball = ent_create (mdlb, 3ballsetup, NULL);
3ball.metal= on;
3ball.albedo = 70;
3ball.ambient = 20;
//4th ball:
var 4ballsetup[3] = 256, -64, -448;
4ball = ent_create (mdlb, 4ballsetup, NULL);
4ball.metal = on;
4ball.albedo = 70;
4ball.ambient = 20;
//5th ball:
var 5ballsetup[3] = 256, -32, -448;
5ball = ent_create (mdlb, 5ballsetup, NULL);
5ball.metal = on;
5ball.albedo = 70;
5ball.ambient = 20;
//6th ball:
var 6ballsetup[3] = 256, 0, -448;
6ball = ent_create (mdlb, 6ballsetup, NULL);
6ball.metal = on;
6ball.albedo = 70;
6ball.ambient= 20;
//7th ball:
var 7ballsetup[3] = 288, 16, -448;
7ball = ent_create (mdlb, 7ballsetup, NULL);
7ball.metal = on;
7ball.albedo = 70;
7ball.ambient= 20;
//8th ball:
var 8ballsetup[3] = 288,-48, -488;
8ball = ent_create (mdlb, 8ballsetup, NULL);
8ball.metal = on;
8ball.albedo = 70;
8ball.ambient= 20;
//9th ball:
var 9ballsetup[3] = 288, -16, -448;
9ball = ent_create (mdlb, 9ballsetup, NULL);
9ball.metal = on;
9ball.albedo = 70;
9ball.ambient= 20;
//10th ball:
var 10ballsetup[3] = 320, -66, -448;
10ball = ent_create (mdlb, 10ballsetup, NULL);
10ball.metal = on;
10ball.albedo = 70;
10ball.ambient= 20;
//11th ball:
var 11ballsetup[3] = 288, -80, -448;
11ball = ent_create (mdlb, 11ballsetup,NULL);
11ball.metal = on;
11ball.albedo = 70;
11ball.ambient= 20;
//12th ball:
var 12ballsetup[3] = 320, -32, -448;
12ball = ent_create (mdlb, 12ballsetup, NULL);
12ball.metal = on;
12ball.albedo = 70;
12ball.ambient= 20;
//13th ball:
var 13ballsetup[3] = 320, 0, -448;
13ball = ent_create (mdlb, 13ballsetup, NULL);
13ball.metal = on;
13ball.albedo = 70;
13ball.ambient= 20;
//14th ball:
var 14ballsetup[3] = 320, -64, -448;
14ball = ent_create (mdlb, 14ballsetup, NULL);
14ball.metal = on;
14ball.albedo = 70;
14ball.ambient= 20;
//15th ball:
var 15ballsetup[3] = 320, 32, -448;
15ball = ent_create (mdlb, 15ballsetup, NULL);
15ball.metal = on;
15ball.albedo = on;
15ball.ambient = on;
//Done setup ball pos!
}
}

function ball_ph()
{

var grav[3] = 0, 0, -1500;
ph_setgravity(grav);
phent_settype (cueball,ph_rigid, ph_sphere);
phent_settype (1ball,ph_rigid, ph_sphere);
phent_settype (2ball,ph_rigid, ph_sphere);
phent_settype (3ball,ph_rigid, ph_sphere);
phent_settype (4ball,ph_rigid, ph_sphere);
phent_settype (5ball,ph_rigid, ph_sphere);
phent_settype (6ball,ph_rigid, ph_sphere);
phent_settype (7ball,ph_rigid, ph_sphere);
phent_settype (8ball,ph_rigid, ph_sphere);
phent_settype (9ball,ph_rigid, ph_sphere);
phent_settype (10ball,ph_rigid, ph_sphere);
phent_settype (11ball,ph_rigid, ph_sphere);
phent_settype (12ball,ph_rigid, ph_sphere);
phent_settype (13ball,ph_rigid, ph_sphere);
phent_settype (14ball,ph_rigid, ph_sphere);
phent_settype (15ball,ph_rigid, ph_sphere);

phent_setmass(cueball, 1.5, ph_sphere);
phent_setmass(1ball, 1.5, ph_sphere);
phent_setmass(2ball, 1.5, ph_sphere);
phent_setmass(3ball, 1.5, ph_sphere);
phent_setmass(4ball, 1.5, ph_sphere);
phent_setmass(5ball, 1.5, ph_sphere);
phent_setmass(6ball, 1.5, ph_sphere);
phent_setmass(7ball, 1.5, ph_sphere);
phent_setmass(8ball, 2, ph_sphere);
phent_setmass(9ball, 1.5, ph_sphere);
phent_setmass(10ball, 1.5, ph_sphere);
phent_setmass(11ball, 1.5, ph_sphere);
phent_setmass(12ball, 1.5, ph_sphere);
phent_setmass(13ball, 1.5, ph_sphere);
phent_setmass(14ball, 1.5, ph_sphere);
phent_setmass(15ball, 1.5, ph_sphere);

phent_setdamping(cueball, 20, 20);
phent_setdamping(1ball, 20, 20);
phent_setdamping(2ball, 20, 20);
phent_setdamping(3ball, 20, 20);
phent_setdamping(4ball, 20, 20);
phent_setdamping(5ball, 20, 20);
phent_setdamping(6ball, 20, 20);
phent_setdamping(7ball, 20, 20);
phent_setdamping(8ball, 20, 20);
phent_setdamping(9ball, 20, 20);
phent_setdamping(10ball, 20, 20);
phent_setdamping(11ball, 20, 20);
phent_setdamping(12ball, 20, 20);
phent_setdamping(13ball, 20, 20);
phent_setdamping(14ball, 20, 20);
phent_setdamping(15ball, 20, 20);

phent_setfriction(cueball, 20);
phent_setfriction(1ball , 20);
phent_setfriction(2ball , 20);
phent_setfriction(3ball , 20);
phent_setfriction(4ball , 20);
phent_setfriction(5ball , 20);
phent_setfriction(6ball , 20);
phent_setfriction(7ball , 20);
phent_setfriction(8ball , 20);
phent_setfriction(9ball , 20);
phent_setfriction(10ball , 20);
phent_setfriction(11ball , 20);
phent_setfriction(12ball , 20);
phent_setfriction(13ball , 20);
phent_setfriction(14ball , 20);
phent_setfriction(15ball , 20);

phent_setelasticity (cueball, 50, 2);
phent_setelasticity (1ball, 50 ,2);
phent_setelasticity (2ball, 50 ,2);
phent_setelasticity (3ball, 50 ,2);
phent_setelasticity (4ball, 50 ,2);
phent_setelasticity (5ball, 50 ,2);
phent_setelasticity (6ball, 50 ,2);
phent_setelasticity (7ball, 50 ,2);
phent_setelasticity (8ball, 50 ,2);
phent_setelasticity (9ball, 50 ,2);
phent_setelasticity (10ball, 50 ,2);
phent_setelasticity (11ball, 50 ,2);
phent_setelasticity (12ball, 50 ,2);
phent_setelasticity (13ball, 50 ,2);
phent_setelasticity (14ball, 50 ,2);
phent_setelasticity (15ball, 50 ,2);

while(1)
{
if (key_u)
{
var boom[3] = 8000,0,0;
phent_addcentralforce(cueball,boom);

}

wait(1);
}
}



Last edited by Matan_Golan_A6; 04/03/04 03:22.
Re: return force?? [Re: Matan_Golan_A6] #24933
04/09/04 10:30
04/09/04 10:30
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
Quote:

why when ball1 hit another ball2
ball2 move by the force but ball1 dont get return force (elastic)




Elasticity is calculated as the product of both objects' elasticity value. Level walls are set to 1.0 (perfectly elastic). If you have two 0.5 balls colliding then the total elasticity will be only 0.25. Instead set one of them to 100 %.


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