Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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
1 registered members (7th_zorro), 793 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Fluid physics problem #136980
06/18/07 10:30
06/18/07 10:30
Joined: Apr 2007
Posts: 582
Germany
Poison Offline OP
User
Poison  Offline OP
User

Joined: Apr 2007
Posts: 582
Germany
jcl or someone help for my fluid physics code my code loads but nothing happens here it is:

VECTOR ball_speed;

ENTITY* fluidwater;
fluidwater = ent_create( "water.hmp", nullvector, NULL );
phent_settype ( fluidwater, PH_WAVE, NULL );
phent_setdamping (fluidwater, 50, 50); // set the damping
phent_addforcelocal ( fluidwater, vector(10,5,.5), nullvector);

ENTITY* ball;
ball = ent_create ("ball.mdl", vector(-400, 0, 100), NULL); // create the ball
ph_setgravity (vector(0, 0, -386)); // set the gravity
phent_settype (ball, PH_RIGID, PH_SPHERE); // set the physics entity type
phent_setmass (ball, 3, PH_SPHERE); // and its mass
phent_setfriction (ball, 80); // set the friction
phent_setdamping (ball, 40, 40); // set the damping
phent_setelasticity (ball, 50, 20); // set the elasticity
while (1)
{
ball_speed.x = 25 * (key_cur - key_cul); // move the ball using the cursor keys
ball_speed.y = 25 * (key_cuu - key_cud); // 25 sets the x / y movement speeds
ball_speed.z = 0; // no need to move on the vertical axis
phent_addtorqueglobal (ball, ball_speed); // add a torque (an angular force) to the ball
camera.x = ball.x - 300; // keep the camera 300 quants behind the ball
camera.y = ball.y; // using the same y with the ball
camera.z = 500; // and place it at z = 1000 quants
camera.tilt = -60; // make it look downwards
wait (1);
}

EDIT:if that donīt works than i donīt know how it works:
function main()
{
my.entity = ball,fluidwater;
fps_max = 140;
level_load("water_test01.wmb"); // load the level
wait (2); // // wait until the level is loaded
}



Everything is possible, just Do it!
Re: Fluid physics problem [Re: Poison] #136981
06/18/07 17:31
06/18/07 17:31
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
From what I've heard, you need Pro for fluid physics...


xXxGuitar511
- Programmer
Re: Fluid physics problem [Re: Poison] #136982
06/18/07 21:12
06/18/07 21:12
Joined: Sep 2002
Posts: 8,177
Netherlands
PHeMoX Offline
Senior Expert
PHeMoX  Offline
Senior Expert

Joined: Sep 2002
Posts: 8,177
Netherlands
Could you post all your code please? I'm pretty sure I can fix it, I've already got water physics working here (using Pro),


Edit: Oookey, this is getting funny, my own fluid water example doesn't work with A6.50.5 , it goes right through it. Not a ripple in the water, however using phent_addforcelocal I can makes ripples, lol, what are we doing wrong here or is/was this a bug in A6.50.5?

Cheers


PHeMoX, Innervision Software (c) 1995-2008

For more info visit: Innervision Software
Re: Fluid physics problem [Re: PHeMoX] #136983
06/19/07 07:25
06/19/07 07:25
Joined: Apr 2007
Posts: 582
Germany
Poison Offline OP
User
Poison  Offline OP
User

Joined: Apr 2007
Posts: 582
Germany
This is already the code please test it


Everything is possible, just Do it!
Re: Fluid physics problem [Re: Poison] #136984
06/19/07 07:36
06/19/07 07:36
Joined: Sep 2002
Posts: 8,177
Netherlands
PHeMoX Offline
Senior Expert
PHeMoX  Offline
Senior Expert

Joined: Sep 2002
Posts: 8,177
Netherlands
I did test it, but your code posted here is incomplete (or is Lite-C which I currently do not use nor know much about..)...

However, my own code doesn't work properly either;

Code:

var terrain_chunk =0;

function main()
{
video_switch(8,32,1);
fps_max = 140;
level_load("FluidTest.wmb"); // load the level
wait(2); // // wait until the level is loaded
camera.x=0;
camera.y=-50;
camera.tilt=-70;
wait(-10);
ph_setgravity (vector(0, 0, -386)); // set the gravity
}

var ball_speed[3];

ENTITY* ball;
action balll
{
ball = my; // create the ball
phent_settype (ball, PH_RIGID, PH_SPHERE); // set the physics entity type
phent_setmass (ball, 3, PH_SPHERE); // and its mass
phent_setfriction (ball, 80); // set the friction
phent_setdamping (ball, 40, 40); // set the damping
phent_setelasticity (ball, 50, 20); // set the elasticity
while(1)
{
ball_speed.x = 50 * (key_cur - key_cul); // move the ball using the cursor keys
ball_speed.y = 50 * (key_cuu - key_cud); // 25 sets the x / y movement speeds
ball_speed.z = 10* (key_space-key_enter); //test
phent_addforcelocal(ball,ball_speed,nullvector);
phent_addtorqueglobal (ball, ball_speed); // add a torque (an angular force) to the ball
wait (1);
}
}

ENTITY* fluidwater;

action water
{
fluidwater = my;
my.material = mtl_water_mirror;
phent_settype(my,PH_WAVE,ph_wave);
phent_setdamping(my,1,1); // set the damping
phent_addforcelocal(my, vector(0,0,.3), nullvector);
wait(1);
}



No problems with the ball, that's working fine, however the fluid object doesn't get distorted by the ball entity. I can add a local force to make the water ripple, but not through the ball.

I think there might be something wrong here, either in my code somewhere or a bug,

Cheers


PHeMoX, Innervision Software (c) 1995-2008

For more info visit: Innervision Software

Moderated by  old_bill, Tobias 

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