1 registered members (AndrewAMD),
552
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
physics in water
#15710
05/23/03 07:18
05/23/03 07:18
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
I let fall the following ball on/in a passable block (water). I really get stange behaviour (the ball becomes like a shark, hehehe!) . What do you think about? Is there a way of improvement? code:
VAR earthgravity[3] = 0,0, -386;
ACTION physik_ball { ph_setgravity( earthgravity );
phent_settype(my, PH_RIGID, PH_SPHERE); phent_setmass(my, 50, PH_SPHERE); phent_setfriction(my, 90); phent_setelasticity(my, 90, 10); phent_setdamping(my, 30, 20 ); }
|
|
|
Re: physics in water
#15712
05/23/03 16:37
05/23/03 16:37
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
Yes, I learned a long time before in physics that you call that density (mass/volume). I did't test to give the water physic properties. Theoretically, if I give the water a mass, maybe the engine count the density(?). But I think that's not the only problem. I also noticed very strange turbulance forces (I gave the water the turbulence texture flag) and my balls (the ones in the game, hehehe) played crazy.
PS: @Marco Grubert: Gratulation, the physic engine is a real great and phantastic stuff!!
|
|
|
Re: physics in water
#15713
05/23/03 22:22
05/23/03 22:22
|
Joined: Oct 2001
Posts: 1,407 Helsinki, Finland
Phantom88
Expert
|
Expert
Joined: Oct 2001
Posts: 1,407
Helsinki, Finland
|
My water sim is working quite well, i just need to add the waves, and its perfect [EDIT]Heres how i do it(hey, it's not elegant, but it works ): I go through all vertices of the model, and if the vertex is under the sea level, i apply a small force to it.[/EDIT] Il'l maybe make a demo if i get the waves working... ~Phantom88~
Programmer, Gamer
ICQ #: 157485106 | Xfire: Phantom1988 | MSN: lauri_andler@hotmail.com | AIM: FinPhantom | YAHOO: FinPhantom
|
|
|
Re: physics in water
#15714
05/24/03 00:21
05/24/03 00:21
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
Sounds interesting!
I didn't used a model for the water, I used a level block. I'll also make a demo to show the "crazy behaviour" in passable blocks. Give me a day...
|
|
|
Re: physics in water
#15715
05/24/03 04:59
05/24/03 04:59
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
Quick answer: there is no buoyancy (sp? - Auftrieb) in the physics engine. It can however be simulated manually. If you see any turbulent behavior then it's either due to a bug in the script or in the engine.
|
|
|
Re: physics in water
#15716
05/24/03 08:42
05/24/03 08:42
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
Ok, as promised, I made a primitiv test level with Delivery, if anybody's interested. The water is a passable level block with a horizontal mirror and a water texture from the standard WAD. Download: here (3.5 MB) Screenshot:
|
|
|
Re: physics in water
#15718
05/24/03 15:21
05/24/03 15:21
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
code:
...the warlock is a great dancer!
Damned! I told him not to drink more than 6 glases of whisky! (ACTION: patrol_path() with a simple event_function()).
|
|
|
Re: physics in water
#15719
05/24/03 21:34
05/24/03 21:34
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
I tested some adding functions, but the physic engine seems not to like water (passable entities) ... (?) Did anybody succeed in this stuff? Code snipplets code:
Example 1 VAR earthgravity[3]; earthgravity[0] = 0; earthgravity[1] = 0; earthgravity[2] = 386; VAR watergravity[3]; watergravity[0] = 0; watergravity[1] = 0; watergravity[2] = 6; WHILE(1) { IF (IN_PASSABLE == 1) { ph_setgravity( watergravity ); } ELSE { ph_setgravity( earthgravity ); } wait (1); } Example 2 VAR force_up_in_passable[3]; force_up_in_passable[0] = 0; force_up_in_passable[1] = 0; force_up_in_passable[2] = 50; WHILE(1) { IF (IN_PASSABLE == 1) { phent_addforceglobal(my,force_up_in_passable,nullvector); } wait (1); }
|
|
|
|