dylantan
Member
|
does esenthel supports rain system
does esenthel supports rain system[/b]
|
|
04-20-2011 10:14 AM |
|
siwykon
Member
|
RE: does esenthel supports rain system
you can create rain using particle! I do that in my project (use particle witch colisions)!
|
|
04-20-2011 10:24 AM |
|
llynx
Member
|
RE: does esenthel supports rain system
|
|
04-20-2011 04:07 PM |
|
siwykon
Member
|
RE: does esenthel supports rain system
It is my rain system (thanks to Seba):
Rain.h:
Quote:struct RAIN
{
Box r_source;
Particles r_rain;
void create();
void draw();
void update();
Bool raining;
};extern RAIN rain;
struct RainHitDetect : PhysCutsCallback // Physical Cuts Test Callback
{
Bool collision;
virtual Bool hit(Int group,Ptr user,Game::Obj *obj)
{
if(obj)
{
collision=true;
return false;
}
else
if(group==AG_TERRAIN)
{
collision=true;
return false;
}
return true;
}
RainHitDetect()
{
collision=false;
}
};
Rain.cpp:
Quote:/******************************************************************************/
#include "stdafx.h"
#include "Start.h"
/******************************************************************************/
RAIN rain;
/******************************************************************************/
void RAIN::create()
{
r_source.set(25,1,25,Vec(0,0,0));
Image *image =Images("particle/drop.gfx");
Color color =Color(153,153,153,116); //Kolor deszczu (szary).
Int elms =Random(2000, 3000); //Random drops from 2000 to 3000.
Flt radius =0.0, //for first time rain don't exist.
life_avg=5.0; //How long rain live.
r_rain.create(image,color,elms,radius,life_avg)
.source(r_source);
r_rain.accel.set(0,-25,0); //All drops move down
r_rain.vel_random=100.0; //How far away from the formed particle falling drops
r_rain.damping=0.98;
}
void RAIN::update()
{
RainHitDetect hited;
Vec2 pos;
if(Players.elms()!=0)
{
r_source.set(25,1,25,Players[0].pos()+Vec(0,10,0));
r_rain.matrix.set(r_source, Players[0].pos()+Vec(0,10,0)); //Create rain particle over Player
}
REP(r_rain.p.elms())
{
Physics.cuts(Capsule(0.1,r_rain.p(i).pos,r_rain.p(i).pos+Vec(0,0.5,0)),hited);
if(hited.collision)
{
r_rain.p(i).life=20; //How long all drops live
r_rain.radius = RandomF(0.04,0.08); //How big are all drops (radius)
r_rain.p(i).ang_vel=20;
}
hited.collision=false;
}
}
Now to see rain you must:
In InitGame():
Quote:rain.create();
In UpdateGame():
Quote:rain.r_rain.update();
rain.update();
In Render():
Quote:switch(Renderer())
{
case RM_BLEND:
case RM_PALETTE:
{
rain.r_rain.draw();
}
break;
}
If you have any problems witch adding this write here.
|
|
04-21-2011 04:33 AM |
|
Rabishan
Member
|
RE: does esenthel supports rain system
that was great thanx
|
|
04-21-2011 09:01 AM |
|
dylantan
Member
|
RE: does esenthel supports rain system
Thanks siwykon! Will try it out ASAP! This is awesome
|
|
04-25-2011 03:51 AM |
|
Brad_Mclain
Member
|
RE: does esenthel supports rain system
Storm/rain effects are also on the roadmap for the engine but they are a long way down.
(This post was last modified: 04-25-2011 03:53 AM by Brad_Mclain.)
|
|
04-25-2011 03:53 AM |
|
dylantan
Member
|
RE: does esenthel supports rain system
(04-25-2011 03:53 AM)Brad_Mclain Wrote: Storm/rain effects are also on the roadmap for the engine but they are a long way down.
Oh. However do you think its possible to overwrite the existing sky effect and add or write it on your own?
|
|
04-25-2011 04:00 AM |
|
Brad_Mclain
Member
|
RE: does esenthel supports rain system
Definitely, you can make use of the current system and add the extras which are missing (rain, snow, storm) to form a weather/environment system.
I am doing this currently, writing a climate based system for weather.
|
|
04-25-2011 05:10 AM |
|
dylantan
Member
|
RE: does esenthel supports rain system
(04-25-2011 05:10 AM)Brad_Mclain Wrote: Definitely, you can make use of the current system and add the extras which are missing (rain, snow, storm) to form a weather/environment system.
I am doing this currently, writing a climate based system for weather.
Oh Thanks for the reply. Will look into this soon
|
|
04-25-2011 09:29 AM |
|