|
|
Fluid Physics
#136695
06/16/07 16:26
06/16/07 16:26
|
Joined: Aug 2005
Posts: 390 Florida
oldschoolj
OP
Senior Member
|
OP
Senior Member
Joined: Aug 2005
Posts: 390
Florida
|
Hi folks,
I'm just starting with physics, and am playing with the new water system. I was wondering why I cant get the water to move at all. It's a hmp. and here is the code. /// Top of code
ENTITY* fluidwater; /// near the top before main function
function main; { /// nothing in here pertaining to the physics yet /// Just the default main function }
action wavemotion { fluidwater=me; phent_settype( fluidwater, PH_WAVE, 0 ); phent_setdamping(my, 50, 1); phent_addforcelocal(fluidwater, vector(0,0,0), nullvector); phent_addobstruction(my, 0.1, my.x); }
/// Bottom of Code
It runs just fine w/ no errors. I assigned the action to the water model, but nothing happens when I walk over or through it. Are there other things I need to put in the code to make it move when touched, or move by its self using PH_WAVE?
A7 Pro
Thanks, Jesse
you can find me with my face in the keyboard, unshaven, listening to some nameless techno tragedy, and hashing through code over a cold cup a stale joe.
__________________________________
yours truly
|
|
|
Re: Fluid Physics
[Re: oldschoolj]
#136696
06/16/07 16:36
06/16/07 16:36
|
Joined: Apr 2007
Posts: 582 Germany
Poison
User
|
User
Joined: Apr 2007
Posts: 582
Germany
|
Here this is an example from the manual:
ENTITY* myCrate; // ... // on startup myCrate = ent_create( "crate.mdl", nullvector, any_function ); phent_settype( myCrate, PH_RIGID, 0 ); phent_settype( myCrate, 0, 0 ); // ... // during gameplay let's have fun with a crate: var position; phent_settype( myCrate, PH_RIGID, PH_BOX ); position= myCrate.x; // this will give you an approximate position //myCrate.x = position + 10; // this won't work! phent_settype( myCrate, 0, 0 ); myCrate.x = position + 10; // unregistered - now we can change the position phent_settype( myCrate, PH_RIGID, PH_BOX ); // restart from new position
Everything is possible, just Do it!
|
|
|
Re: Fluid Physics
[Re: Poison]
#136697
06/16/07 16:45
06/16/07 16:45
|
Joined: Apr 2007
Posts: 582 Germany
Poison
User
|
User
Joined: Apr 2007
Posts: 582
Germany
|
I think this work i havent got time to test it:
ENTITY* myWater; myWater = ent_create( "water.hmb", nullvector, any_function ); phent_settype( myWater, PH_WAVE, 0 ); phent_settype( myWater, 0, 0 ); var position; phent_settype( myWater, PH_WAVE, 0 ); position= myWater.x; phent_settype( myWater, 0, 0 ); myWater.x = position + 10; ent_settype( myWater, PH_WAVE, 0 );
Everything is possible, just Do it!
|
|
|
Re: Fluid Physics
[Re: Poison]
#136698
06/16/07 17:29
06/16/07 17:29
|
Joined: Aug 2005
Posts: 390 Florida
oldschoolj
OP
Senior Member
|
OP
Senior Member
Joined: Aug 2005
Posts: 390
Florida
|
That code has no change, it runs, but nothing happens
you can find me with my face in the keyboard, unshaven, listening to some nameless techno tragedy, and hashing through code over a cold cup a stale joe.
__________________________________
yours truly
|
|
|
Re: Fluid Physics
[Re: oldschoolj]
#136699
06/16/07 18:34
06/16/07 18:34
|
Joined: Aug 2005
Posts: 390 Florida
oldschoolj
OP
Senior Member
|
OP
Senior Member
Joined: Aug 2005
Posts: 390
Florida
|
Ok so this code that follows, if your quick enough to catch, wil move the water a bit apon start up, but the ripples stop pretty much right away. Also, the water still doesnt move when something passes through it. I combined the tutorials rolling ball code with mine: ENTITY* fluidwater; VECTOR ball_speed; ENTITY* ball; function main() { fps_max = 140; level_load("water_test01.wmb"); // load the level wait (2); // // wait until the level is loaded fluidwater = ent_create( "water_motion01_n.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); 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); } } so basicly I need to figure out how to a - keep the water rippling by it's self b- have the ball interact with the water properly any helpers 
you can find me with my face in the keyboard, unshaven, listening to some nameless techno tragedy, and hashing through code over a cold cup a stale joe.
__________________________________
yours truly
|
|
|
Re: Fluid Physics
[Re: oldschoolj]
#136700
06/17/07 09:55
06/17/07 09:55
|
Joined: Apr 2007
Posts: 582 Germany
Poison
User
|
User
Joined: Apr 2007
Posts: 582
Germany
|
Test this one:
VECTOR ball_speed;
ENTITY* fluidwater; fluidwater = ent_create( "water_motion01_n.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 }
Last edited by Gentek; 06/18/07 07:02.
Everything is possible, just Do it!
|
|
|
Re: Fluid Physics
[Re: Poison]
#136701
06/17/07 23:24
06/17/07 23:24
|
Joined: Aug 2005
Posts: 390 Florida
oldschoolj
OP
Senior Member
|
OP
Senior Member
Joined: Aug 2005
Posts: 390
Florida
|
level loads, but neither the ball or the water is visible. I think thats because I did the ent_creates in the main function. Not sure if the code works
you can find me with my face in the keyboard, unshaven, listening to some nameless techno tragedy, and hashing through code over a cold cup a stale joe.
__________________________________
yours truly
|
|
|
Re: Fluid Physics
[Re: oldschoolj]
#136702
06/18/07 16:09
06/18/07 16:09
|
Anonymous
Unregistered
|
Anonymous
Unregistered
|
@oldschoolj: i think you need for the fluid feature the pro edition. and how i see in your profile you have only the com edition so it doesn't work.
|
|
|
Re: Fluid Physics
[Re: ]
#136703
06/18/07 16:13
06/18/07 16:13
|
Joined: Apr 2007
Posts: 582 Germany
Poison
User
|
User
Joined: Apr 2007
Posts: 582
Germany
|
Fear 411 have you got the A7 pro edition ??ß if you have did this code work ???
Everything is possible, just Do it!
|
|
|
Re: Fluid Physics
[Re: Poison]
#136704
06/18/07 17:36
06/18/07 17:36
|
Anonymous
Unregistered
|
Anonymous
Unregistered
|
@gentek: no,i have the com edition!sry
|
|
|
|