Rain
Code:
I took the rain from mog weather and put it in MV3D folder named Rain. Can create it with script call mv3d.createRain();mv3d.createRain = function () {
var coreSphere = BABYLON.MeshBuilder.CreateSphere("coreSphere", {diameter: 0.01, segments: 1}, mv3d.scene);
coreSphere.x = 52;
coreSphere.y = 47;
coreSphere.z = 20;
var boxEmitter = new BABYLON.BoxParticleEmitter();
boxEmitter.minEmitBox = new BABYLON.Vector3(-50, 0, -50);
boxEmitter.maxEmitBox = new BABYLON.Vector3(50, 0, 50);
var particleSystem = new BABYLON.GPUParticleSystem("Rain", 45000, mv3d.scene);
particleSystem.particleTexture = new BABYLON.Texture("/img/MV3D/Rain.png", mv3d.scene);
particleSystem.color1 = new BABYLON.Color4(0.7, 0.8, 1.0, 0.5);
particleSystem.color2 = new BABYLON.Color4(0.7, 0.8, 1.0, 1.0);
particleSystem.colorDead = new BABYLON.Color4(0.7, 0.8, 1.0, 0.1);
particleSystem.minLifeTime = 0.5;
particleSystem.maxLifeTime = 0.5;
particleSystem.minSize = 0.2;
particleSystem.maxSize = 0.8;
particleSystem.emitter = coreSphere;
particleSystem.particleEmitterType = boxEmitter;
particleSystem.emitRate = 15000;
particleSystem.blendMode = BABYLON.ParticleSystem.BLENDMODE_STANDARD;
particleSystem.gravity = new BABYLON.Vector3(0, -1.81, 0);
particleSystem.minEmitPower = -250;
particleSystem.maxEmitPower = -500;
particleSystem.start();
mv3d.rain = coreSphere;
mv3d.rainParticle = particleSystem;
};It has to follow player around with a parallel though as linking to map objects doesn't work right as y and z seems reversed, but the object I create and link it to that follows player works for some reason, put a wait between movement.
Code:
To stop it completely do a script call ofmv3d.rain.x = $gamePlayer.x;
mv3d.rain.y = $gamePlayer.y;
mv3d.rain.z = $gamePlayer.z + 20;Code:
to stop and start temporarily domv3d.rain.dispose();
mv3d.rainParticle.dispose();Code:
to edit things mid playing you can edit the properties of mv3d.rainParticle and do
mv3d.rainParticle.stop();
mv3d.rainParticle.start();Code:
though it doesn't really edit mid play and resets it, should probably increase speed if you want to do that stuff. The emitBox settings is the range of the rain, so -50 x, 0 z, -50 y and +50 x, 0 z, +50 y from player position, change it in file can't edit later or I didn't really care to try to edit it. Starting position of it is 20 z higher than player. No idea if there's any problems with it, it will still be there when you change maps but without parallel it will be at 0,0 corner. It also uses GPU rendering so shouldn't really lag at all?mv3d.rainParticle.reset();EDIT: Did find a problem with saving, you can use this
Code:
Just put switch you want to turn on while raining into it. It restarts so you could always switch to a faster particle call if you want. You do need to put the wait in the parallel to before the movement script, you don't need it low, 20 frames or even really high works, probably. Or you could add it to check every step taken instead of a parallel in Game_Player section.Game_System.prototype.onAfterLoad = function() {
Graphics.frameCount = this._framesOnSave;
AudioManager.playBgm(this._bgmOnSave);
AudioManager.playBgs(this._bgsOnSave);
if ($gameSwitches.value(1)) {
mv3d.createRain();
}
};
