Wind

Posted By: agreenknight

Wind - 06/30/04 09:57

I was just wondering, if I made like a cube of air, passible, and invisible, and it hit like models, how would the physic's engine take it? I would it be possible to simulate wind this way?
Posted By: fastlane69

Re: Wind - 06/30/04 13:40

The very notion of "Passable" is incompatable with Physics and thus any Physics Engine.
To my knowledge, the Passable entity should just go thru any entity.


To simulate wind quite effectively, you need nothing more than phent_addforceglobal.
Posted By: agreenknight

Re: Wind - 06/30/04 18:05

Thanks Fastlane

Okay, would it be the same with water?
Posted By: Phantom88

Re: Wind - 06/30/04 21:53

Quote:

Thanks Fastlane

Okay, would it be the same with water?



No Water doesn't affect the body if it isn't inside it(the water volume/box/plane...), and if it's only partially inside it it gets VERY hard. If you aren't a physics genious I wouldn't try to simulate water(unless you accept odd looking results...)

~Phantom88~
Posted By: Phantom88

Re: Wind - 06/30/04 22:00

Just thought of an way to approximate wind that could work much better than addforceglobal. Heres what you should do:
1. Iterate troough all vertices of the model every frame
2. Apply a force in the opposite direction of the normal of the vertex(only if the normal faces the wind)at the vertices position.
Or alternate #2 (Don't know which )
2. Apply a force in the opposite direction of the bounce vector of the normal of the vertex and the winds direction(only if the normal faces the wind) at the vertices position

I think #2 should work...

That sounds very complex but i think it might work pretty well(No scientific proof whatsoever, just improvising...)

This would theoretically spin the modell with the wind, not just move it, but since it doesn't take into account the sizes of the faces(every vertex has an equally sized effect) it's very crude and i don't even know if it is mathematically correct or works at all, just throwing an idea...

~Phantom88~
Posted By: fastlane69

Re: Wind - 07/01/04 03:02

1) ou still need phent_addforcegolbal (or addforcelocal) to apply the force at the vertices.

1) Just using even one Phen_addforceglobal call off-center will spin the model.

2) The phent_addforce commands add a force at a point, not to a face.


Not quite sure what we are gaining or doing diffrently in your examples.
Posted By: Velorien

Re: Wind - 07/01/04 03:06

Couldn't you just use
var wind[3] = 20, 0, -386; // play with the numbers, x is the wind strength
ph_setgravity(wind);

To simulate the wind?
Posted By: Orange Brat

Re: Wind - 07/01/04 03:27

I ported a wind system to c-script a few months ago. Check it out at the link. There's an example on how to use it with the physics engine:

http://www.conitecserver.com/ubbthreads/showflat.php?Cat=&Board=UBB3&Number=300853

It's much more complex than the simple(but still effective) way that Verorien offered. If all you need is a constant breeze in a given direction, then his way is all you need. Mine gives you a completely random system with gusts, stillness, direction change, and a direction indicator. It can also be setup for non-random behavior, though.

It's not nessarily the best way and it may or may not be all the efficient, but it's there for you to tinker with if you want.
Posted By: fastlane69

Re: Wind - 07/01/04 03:34

Absolutly Velo.
Posted By: agreenknight

Re: Wind - 07/01/04 11:22

thanks,

is water hard because of the wind? How would you start that?
Posted By: Orange Brat

Re: Wind - 07/02/04 00:35

I don't know much about water. Marco is working on dynamic water(see Forecast). I don't know how it will work, but maybe you'll be able to apply the wind script to it. That would be cool if it worked right...probably be slow as all get out. You can apply it to the vertices of tree models, but I never successfully coded it. Almost at one point, but slow.

The original C++ version of the script along with the vertices crap is here:

http://edgarapoe.home.mindspring.com/quixotic/blustery_trees.htm

I added a lot of my own stuff to the ported version, but the model manipulation code is there along with an EXE of his version.
Posted By: Velorien

Re: Wind - 07/02/04 02:00

Hey Fastlane, longtime no read
Posted By: fastlane69

Re: Wind - 07/02/04 04:19

Only cause you don't come around and visit anymore!
Posted By: Marco_Grubert

Re: Wind - 07/02/04 04:50

Quote:

I don't know much about water. Marco is working on dynamic water(see Forecast). I don't know how it will work, but maybe you'll be able to apply the wind script to it.


Dynamic water only allows adding forces in the Z direction, i.e. moving vertices up and down (propagation of waves is then calculated based upon the initial displacement).
Posted By: agreenknight

Re: Wind - 07/02/04 23:46

Yeah, I was aware of the water forcast. What were your problems with it?
Posted By: agreenknight

Re: Wind - 07/06/04 13:23

I was wondering can this simulate a Tornado?
Posted By: myrlyn68

Re: Wind - 07/06/04 14:22

Considering that you would be hard pressed to get a group of meterologists to agree on what actually is happening insode a tornado (other than it is spinning really fast)...no, it could not simulate a tornado.

If you just want wind...grab the formula for a helix and send particles spinning with a bit of noise applied. When they impact with an object - apply force in that general direction.

If you are looking to simulate the destructive nature of tornadoes...I would say look else where. Simulating real world damage is not something that you will be able to do under normal circumstances (by normal I mean using normal hardware and normal data sets which are commonly available).

The work which I was doing dealt with similiar problems, and using clusters of 10 of the fastest computers you can get your hands on, combined with structural data gleaned over months and months of field tests we could give you impact information that was mostly accurate...and that only took about 15 minutes for 1 minute worth of output data to be calculated (roughly .07 FPS...not something that is playable by any means).

Fake it. That is the key to simulations in real time.
Posted By: Orange Brat

Re: Wind - 07/06/04 15:45

Quote:

I was wondering can this simulate a Tornado?




The script is more of a gust/calm simulation than anything else. You can have it blow in one direction or blow from north and then to the south. Lots of randomness built in.

The only way I can think of to "fake" a tornado would be to constantly change the direction. The relevent part would be this:

Code:
  
var d_direction_min[3] = -1,0,0; // currently set to W
var d_direction_max[3] = -1,0,0; // currently set to W
/* DIRECTIONS ARE INTO THE CARDINAL DIRECTION(i.e. north wind is blowing towards north)
0, 1, 0 north
0,-1, 0 south
-1, 0, 0 west
1, 0, 0 east */



The "Z" is never used, so you'd need to change the "X" and "Y" to correspond to the appropriate cardinal direction. Start out with the initial value and then when the time between changes expires, you change the X/Y to the appropriate value(0, 1, or -1). Both the _min and _max would need to be the same value since that insures the wind will always blow in that one direction. If they are different, it will blow from one extreme to the other, though maybe that would give it some chaotic personality.

The only problem is is that the wind isn't really like that in a tornado. It isn't cyclonic, it's blowing in a given direction. Maybe if you the rate of change was really fast it would be good enough for games.
© 2024 lite-C Forums