mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-13 15:56:35 +01:00
[VFX Attract] Fix crash on update.
This commit is contained in:
parent
778a1474c7
commit
aee11d6c82
11 changed files with 200 additions and 169 deletions
|
@ -128,8 +128,8 @@
|
|||
{"name":"Shaders","order":14,"path":"folders/nodes/data/simulation/smokeSim/Shaders.yy",},
|
||||
{"name":"strandSim","order":5,"path":"folders/nodes/data/simulation/strandSim.yy",},
|
||||
{"name":"VFX","order":6,"path":"folders/nodes/data/simulation/VFX.yy",},
|
||||
{"name":"__legacy","order":12,"path":"folders/nodes/data/simulation/VFX/__legacy.yy",},
|
||||
{"name":"generators","order":1,"path":"folders/nodes/data/simulation/VFX/generators.yy",},
|
||||
{"name":"affector","order":1,"path":"folders/nodes/data/simulation/VFX/affector.yy",},
|
||||
{"name":"generators","order":2,"path":"folders/nodes/data/simulation/VFX/generators.yy",},
|
||||
{"name":"tiler","order":18,"path":"folders/nodes/data/tiler.yy",},
|
||||
{"name":"shaders","order":1,"path":"folders/nodes/data/tiler/shaders.yy",},
|
||||
{"name":"sprites","order":2,"path":"folders/nodes/data/tiler/sprites.yy",},
|
||||
|
@ -429,7 +429,6 @@
|
|||
{"name":"__node_template","order":20,"path":"scripts/__node_template/__node_template.yy",},
|
||||
{"name":"__node_value_object","order":3,"path":"scripts/__node_value_object/__node_value_object.yy",},
|
||||
{"name":"__node_value_processor","order":5,"path":"scripts/__node_value_processor/__node_value_processor.yy",},
|
||||
{"name":"__node_VFX_effector","order":8,"path":"scripts/__node_VFX_effector/__node_VFX_effector.yy",},
|
||||
{"name":"__node","order":7,"path":"scripts/__node/__node.yy",},
|
||||
{"name":"__panel_empty","order":7,"path":"scripts/__panel_empty/__panel_empty.yy",},
|
||||
{"name":"__panel_linear_setting","order":8,"path":"scripts/__panel_linear_setting/__panel_linear_setting.yy",},
|
||||
|
@ -450,13 +449,13 @@
|
|||
{"name":"__vec3","order":8,"path":"scripts/__vec3/__vec3.yy",},
|
||||
{"name":"__vec4","order":9,"path":"scripts/__vec4/__vec4.yy",},
|
||||
{"name":"__vector","order":10,"path":"scripts/__vector/__vector.yy",},
|
||||
{"name":"__VFX","order":2,"path":"scripts/__VFX/__VFX.yy",},
|
||||
{"name":"__VFX","order":3,"path":"scripts/__VFX/__VFX.yy",},
|
||||
{"name":"_3d_rotation","order":6,"path":"scripts/_3d_rotation/_3d_rotation.yy",},
|
||||
{"name":"_draw_defines","order":15,"path":"scripts/_draw_defines/_draw_defines.yy",},
|
||||
{"name":"_line_drawer","order":18,"path":"scripts/_line_drawer/_line_drawer.yy",},
|
||||
{"name":"_node_smoke","order":8,"path":"scripts/_node_smoke/_node_smoke.yy",},
|
||||
{"name":"_node_strand_affector","order":10,"path":"scripts/_node_strand_affector/_node_strand_affector.yy",},
|
||||
{"name":"_node_VFX_spawner","order":3,"path":"scripts/_node_VFX_spawner/_node_VFX_spawner.yy",},
|
||||
{"name":"_node_VFX_spawner","order":4,"path":"scripts/_node_VFX_spawner/_node_VFX_spawner.yy",},
|
||||
{"name":"_smokeSim_domain","order":16,"path":"scripts/_smokeSim_domain/_smokeSim_domain.yy",},
|
||||
{"name":"action_loader","order":15,"path":"scripts/action_loader/action_loader.yy",},
|
||||
{"name":"addon_function","order":3,"path":"scripts/addon_function/addon_function.yy",},
|
||||
|
@ -981,7 +980,7 @@
|
|||
{"name":"node_palette_shrink","order":15,"path":"scripts/node_palette_shrink/node_palette_shrink.yy",},
|
||||
{"name":"node_palette_sort","order":9,"path":"scripts/node_palette_sort/node_palette_sort.yy",},
|
||||
{"name":"node_palette","order":4,"path":"scripts/node_palette/node_palette.yy",},
|
||||
{"name":"node_particle","order":11,"path":"scripts/node_particle/node_particle.yy",},
|
||||
{"name":"node_particle","order":10,"path":"scripts/node_particle/node_particle.yy",},
|
||||
{"name":"node_path_3d","order":1,"path":"scripts/node_path_3d/node_path_3d.yy",},
|
||||
{"name":"node_path_anchor","order":15,"path":"scripts/node_path_anchor/node_path_anchor.yy",},
|
||||
{"name":"node_path_array","order":13,"path":"scripts/node_path_array/node_path_array.yy",},
|
||||
|
@ -1240,18 +1239,18 @@
|
|||
{"name":"node_vector4","order":6,"path":"scripts/node_vector4/node_vector4.yy",},
|
||||
{"name":"node_VFX_accelerate","order":1,"path":"scripts/node_VFX_accelerate/node_VFX_accelerate.yy",},
|
||||
{"name":"node_VFX_attract","order":2,"path":"scripts/node_VFX_attract/node_VFX_attract.yy",},
|
||||
{"name":"node_VFX_boids","order":10,"path":"scripts/node_VFX_boids/node_VFX_boids.yy",},
|
||||
{"name":"node_VFX_boids","order":9,"path":"scripts/node_VFX_boids/node_VFX_boids.yy",},
|
||||
{"name":"node_VFX_destroy","order":3,"path":"scripts/node_VFX_destroy/node_VFX_destroy.yy",},
|
||||
{"name":"node_VFX_group_inline","order":5,"path":"scripts/node_VFX_group_inline/node_VFX_group_inline.yy",},
|
||||
{"name":"node_VFX_oscillate","order":9,"path":"scripts/node_VFX_oscillate/node_VFX_oscillate.yy",},
|
||||
{"name":"node_VFX_oscillate","order":8,"path":"scripts/node_VFX_oscillate/node_VFX_oscillate.yy",},
|
||||
{"name":"node_VFX_override","order":6,"path":"scripts/node_VFX_override/node_VFX_override.yy",},
|
||||
{"name":"node_VFX_renderer_output","order":1,"path":"scripts/node_VFX_renderer_output/node_VFX_renderer_output.yy",},
|
||||
{"name":"node_VFX_renderer","order":7,"path":"scripts/node_VFX_renderer/node_VFX_renderer.yy",},
|
||||
{"name":"node_VFX_repel","order":4,"path":"scripts/node_VFX_repel/node_VFX_repel.yy",},
|
||||
{"name":"node_VFX_spawner","order":9,"path":"scripts/node_VFX_spawner/node_VFX_spawner.yy",},
|
||||
{"name":"node_VFX_spawner","order":8,"path":"scripts/node_VFX_spawner/node_VFX_spawner.yy",},
|
||||
{"name":"node_VFX_triangulate","order":1,"path":"scripts/node_VFX_triangulate/node_VFX_triangulate.yy",},
|
||||
{"name":"node_VFX_turbulence","order":5,"path":"scripts/node_VFX_turbulence/node_VFX_turbulence.yy",},
|
||||
{"name":"node_VFX_variable","order":10,"path":"scripts/node_VFX_variable/node_VFX_variable.yy",},
|
||||
{"name":"node_VFX_variable","order":9,"path":"scripts/node_VFX_variable/node_VFX_variable.yy",},
|
||||
{"name":"node_VFX_vortex","order":6,"path":"scripts/node_VFX_vortex/node_VFX_vortex.yy",},
|
||||
{"name":"node_VFX_wind","order":7,"path":"scripts/node_VFX_wind/node_VFX_wind.yy",},
|
||||
{"name":"node_vignette","order":18,"path":"scripts/node_vignette/node_vignette.yy",},
|
||||
|
|
|
@ -18,7 +18,6 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
node_draw_icon = s_node_vfx_accel;
|
||||
|
||||
setDimension(96, 48);
|
||||
seed = 1;
|
||||
|
||||
newInput(0, nodeValue_Particle("Particles", self, -1 ))
|
||||
.setVisible(true, true);
|
||||
|
@ -58,6 +57,33 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
|
||||
UPDATE_PART_FORWARD
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
falloff = CURVE_DEF_01;
|
||||
fallDist = 0;
|
||||
|
||||
area_x = 0; area_y = 0;
|
||||
area_w = 0; area_h = 0;
|
||||
area_t = 0;
|
||||
|
||||
area_x0 = 0; area_x1 = 0;
|
||||
area_y0 = 0; area_y1 = 0;
|
||||
|
||||
strength = 0;
|
||||
effectVec = [ 0, 0 ];
|
||||
effectVx = 0; effectVy = 0;
|
||||
|
||||
rotate = [ 0, 0 ];
|
||||
rotateX = 0; rotateY = 0;
|
||||
|
||||
scale = [ 0, 0, 0, 0 ];
|
||||
scaleX0 = 0; scaleX1 = 0;
|
||||
scaleY0 = 0; scaleY1 = 0;
|
||||
|
||||
seed = 1;
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||
inputs[1].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
|
||||
|
@ -100,76 +126,85 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
}
|
||||
}
|
||||
|
||||
function reset() {
|
||||
resetSeed();
|
||||
}
|
||||
function reset() { resetSeed(); }
|
||||
|
||||
static resetSeed = function() {
|
||||
seed = getInputData(8);
|
||||
}
|
||||
static resetSeed = function() { seed = getInputData(8); }
|
||||
|
||||
function onAffect(part, str) {}
|
||||
|
||||
function affect(part) {
|
||||
if(!part.active) return;
|
||||
|
||||
var _area = getInputData(1);
|
||||
var _fall = getInputData(2);
|
||||
var _fads = getInputData(3);
|
||||
|
||||
var _area_x = _area[0];
|
||||
var _area_y = _area[1];
|
||||
var _area_w = _area[2];
|
||||
var _area_h = _area[3];
|
||||
var _area_t = _area[4];
|
||||
|
||||
var _area_x0 = _area_x - _area_w;
|
||||
var _area_x1 = _area_x + _area_w;
|
||||
var _area_y0 = _area_y - _area_h;
|
||||
var _area_y1 = _area_y + _area_h;
|
||||
|
||||
random_set_seed(part.seed + seed);
|
||||
|
||||
var str = 0, in, _dst;
|
||||
var _in, _dst;
|
||||
var pv = part.getPivot();
|
||||
|
||||
if(_area_t == AREA_SHAPE.rectangle) {
|
||||
in = point_in_rectangle(pv[0], pv[1], _area_x0, _area_y0, _area_x1, _area_y1)
|
||||
_dst = min( distance_to_line(pv[0], pv[1], _area_x0, _area_y0, _area_x1, _area_y0),
|
||||
distance_to_line(pv[0], pv[1], _area_x0, _area_y1, _area_x1, _area_y1),
|
||||
distance_to_line(pv[0], pv[1], _area_x0, _area_y0, _area_x0, _area_y1),
|
||||
distance_to_line(pv[0], pv[1], _area_x1, _area_y0, _area_x1, _area_y1));
|
||||
} else if(_area_t == AREA_SHAPE.elipse) {
|
||||
var _dirr = point_direction(_area_x, _area_y, pv[0], pv[1]);
|
||||
var _epx = _area_x + lengthdir_x(_area_w, _dirr);
|
||||
var _epy = _area_y + lengthdir_y(_area_h, _dirr);
|
||||
if(area_t == AREA_SHAPE.rectangle) {
|
||||
_in = point_in_rectangle(pv[0], pv[1], area_x0, area_y0, area_x1, area_y1)
|
||||
_dst = min( distance_to_line(pv[0], pv[1], area_x0, area_y0, area_x1, area_y0),
|
||||
distance_to_line(pv[0], pv[1], area_x0, area_y1, area_x1, area_y1),
|
||||
distance_to_line(pv[0], pv[1], area_x0, area_y0, area_x0, area_y1),
|
||||
distance_to_line(pv[0], pv[1], area_x1, area_y0, area_x1, area_y1));
|
||||
|
||||
in = point_distance(_area_x, _area_y, pv[0], pv[1]) < point_distance(_area_x, _area_y, _epx, _epy);
|
||||
} else if(area_t == AREA_SHAPE.elipse) {
|
||||
var _dirr = point_direction(area_x, area_y, pv[0], pv[1]);
|
||||
var _epx = area_x + lengthdir_x(area_w, _dirr);
|
||||
var _epy = area_y + lengthdir_y(area_h, _dirr);
|
||||
|
||||
_in = point_distance(area_x, area_y, pv[0], pv[1]) < point_distance(area_x, area_y, _epx, _epy);
|
||||
_dst = point_distance(pv[0], pv[1], _epx, _epy);
|
||||
}
|
||||
|
||||
if(_dst <= _fads) {
|
||||
var inf = in? 0.5 + _dst / _fads : 0.5 - _dst / _fads;
|
||||
str = eval_curve_x(_fall, clamp(inf, 0., 1.));
|
||||
} else if(in)
|
||||
str = 1;
|
||||
|
||||
if(str == 0) return;
|
||||
var str = bool(_in);
|
||||
if(_dst <= fallDist) {
|
||||
var inf = _in? 0.5 + _dst / fallDist : 0.5 - _dst / fallDist;
|
||||
str = eval_curve_x(falloff, clamp(inf, 0., 1.));
|
||||
}
|
||||
|
||||
if(str <= 0) return;
|
||||
random_set_seed(part.seed + seed);
|
||||
onAffect(part, str);
|
||||
}
|
||||
|
||||
static update = function(frame = CURRENT_FRAME) {
|
||||
var val = getInputData(0);
|
||||
outputs[0].setValue(val);
|
||||
|
||||
if(val == -1) return;
|
||||
|
||||
var _area = getInputData(1);
|
||||
falloff = getInputData(2);
|
||||
fallDist = getInputData(3);
|
||||
|
||||
effectVec = getInputData(4);
|
||||
strength = getInputData(5);
|
||||
rotate = getInputData(6);
|
||||
scale = getInputData(7);
|
||||
|
||||
area_x = _area[0];
|
||||
area_y = _area[1];
|
||||
area_w = _area[2];
|
||||
area_h = _area[3];
|
||||
area_t = _area[4];
|
||||
|
||||
area_x0 = area_x - area_w;
|
||||
area_x1 = area_x + area_w;
|
||||
area_y0 = area_y - area_h;
|
||||
area_y1 = area_y + area_h;
|
||||
|
||||
effectVx = effectVec[0]; effectVy = effectVec[1];
|
||||
rotateX = rotate[0]; rotateY = rotate[1];
|
||||
scaleX0 = scale[0]; scaleX1 = scale[1];
|
||||
scaleY0 = scale[2]; scaleY1 = scale[3];
|
||||
|
||||
onVFXUpdate(frame);
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
if(!is_array(val) || array_length(val) == 0) return;
|
||||
if(!is_array(val[0])) val = [ val ];
|
||||
|
||||
for( var i = 0, n = array_length(val); i < n; i++ )
|
||||
for( var j = 0; j < array_length(val[i]); j++ ) {
|
||||
for( var j = 0; j < array_length(val[i]); j++ )
|
||||
affect(val[i][j]);
|
||||
}
|
||||
|
||||
var jun = outputs[0];
|
||||
for(var j = 0; j < array_length(jun.value_to); j++) {
|
||||
|
@ -178,6 +213,8 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
}
|
||||
}
|
||||
|
||||
static onVFXUpdate = function(frame = CURRENT_FRAME) {}
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
draw_sprite_fit(node_draw_icon, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
||||
|
|
|
@ -3,22 +3,21 @@ function Node_VFX_Accelerate(_x, _y, _group = noone) : Node_VFX_effector(_x, _y,
|
|||
node_draw_icon = s_node_vfx_accel;
|
||||
|
||||
function onAffect(part, str) {
|
||||
var _vect = getInputData(4);
|
||||
var _sten = getInputData(5);
|
||||
var _rot_range = getInputData(6);
|
||||
var _sca_range = getInputData(7);
|
||||
var _rot = random_range(_rot_range[0], _rot_range[1]);
|
||||
var _sca = [ random_range(_sca_range[0], _sca_range[1]), random_range(_sca_range[2], _sca_range[3]) ];
|
||||
var _rot = random_range(rotateX, rotateY);
|
||||
var _scX = random_range(scaleX0, scaleX1);
|
||||
var _scY = random_range(scaleY0, scaleY1);
|
||||
|
||||
part.speedx = part.speedx + _vect[0] * str * _sten;
|
||||
part.speedy = part.speedy + _vect[1] * str * _sten;
|
||||
part.speedx = part.speedx + effectVx * str * strength;
|
||||
part.speedy = part.speedy + effectVy * str * strength;
|
||||
|
||||
part.rot += _rot * str;
|
||||
|
||||
var scx_s = _sca[0] * str;
|
||||
var scy_s = _sca[1] * str;
|
||||
var scx_s = _scX * str;
|
||||
var scy_s = _scY * str;
|
||||
|
||||
if(scx_s < 0) part.scx = lerp_linear(part.scx, 0, abs(scx_s));
|
||||
else part.scx += sign(part.scx) * scx_s;
|
||||
|
||||
if(scy_s < 0) part.scy = lerp_linear(part.scy, 0, abs(scy_s));
|
||||
else part.scy += sign(part.scy) * scy_s;
|
||||
}
|
||||
|
|
|
@ -8,35 +8,34 @@ function Node_VFX_Attract(_x, _y, _group = noone) : Node_VFX_effector(_x, _y, _g
|
|||
|
||||
array_push(input_display_list, effector_input_length + 0);
|
||||
|
||||
destroyMiddle = false;
|
||||
|
||||
static onVFXUpdate = function(frame = CURRENT_FRAME) {
|
||||
destroyMiddle = getInputData(effector_input_length + 0);
|
||||
}
|
||||
|
||||
function onAffect(part, str) {
|
||||
var _area = getInputData(1);
|
||||
var _area_x = _area[0];
|
||||
var _area_y = _area[1];
|
||||
|
||||
var _sten = getInputData(5);
|
||||
var _rot_range = getInputData(6);
|
||||
var _sca_range = getInputData(7);
|
||||
var _rot = random_range(_rot_range[0], _rot_range[1]);
|
||||
var _sca = [ random_range(_sca_range[0], _sca_range[1]), random_range(_sca_range[2], _sca_range[3]) ];
|
||||
|
||||
var _dest = getInputData(effector_input_length + 2);
|
||||
var _rot = random_range(rotateX, rotateY);
|
||||
var _scX = random_range(scaleX0, scaleX1);
|
||||
var _scY = random_range(scaleY0, scaleY1);
|
||||
|
||||
var pv = part.getPivot();
|
||||
var dirr = point_direction(pv[0], pv[1], _area_x, _area_y);
|
||||
part.x = part.x + lengthdir_x(_sten * str, dirr);
|
||||
part.y = part.y + lengthdir_y(_sten * str, dirr);
|
||||
|
||||
var dirr = point_direction(pv[0], pv[1], area_x, area_y);
|
||||
part.x = part.x + lengthdir_x(strength * str, dirr);
|
||||
part.y = part.y + lengthdir_y(strength * str, dirr);
|
||||
part.rot += _rot * str;
|
||||
|
||||
var scx_s = _sca[0] * str;
|
||||
var scy_s = _sca[1] * str;
|
||||
var scx_s = _scX * str;
|
||||
var scy_s = _scY * str;
|
||||
|
||||
if(scx_s < 0) part.sc_sx = lerp_linear(part.sc_sx, 0, abs(scx_s));
|
||||
else part.sc_sx += sign(part.sc_sx) * scx_s;
|
||||
|
||||
if(scy_s < 0) part.sc_sy = lerp_linear(part.sc_sy, 0, abs(scy_s));
|
||||
else part.sc_sy += sign(part.sc_sy) * scy_s;
|
||||
|
||||
if(_dest && point_distance(part.x, part.y, _area_x, _area_y) <= _sten)
|
||||
if(!destroyMiddle) return;
|
||||
if(point_distance(part.x, part.y, area_x, area_y) <= strength)
|
||||
part.kill();
|
||||
}
|
||||
}
|
|
@ -7,9 +7,6 @@ function Node_VFX_Destroy(_x, _y, _group = noone) : Node_VFX_effector(_x, _y, _g
|
|||
inputs[7].setVisible(false, false);
|
||||
|
||||
function onAffect(part, str) {
|
||||
var _sten = getInputData(5);
|
||||
|
||||
if(random(1) < str * _sten)
|
||||
part.kill();
|
||||
if(random(1) < str * strength) part.kill();
|
||||
}
|
||||
}
|
|
@ -14,23 +14,24 @@ function Node_VFX_Oscillate(_x, _y, _group = noone) : Node_VFX_effector(_x, _y,
|
|||
|
||||
array_push(input_display_list, effector_input_length + 0, effector_input_length + 1, effector_input_length + 2);
|
||||
|
||||
amplitude = 0;
|
||||
frequency = 0;
|
||||
mulpSpd = false;
|
||||
|
||||
static onVFXUpdate = function(frame = CURRENT_FRAME) {
|
||||
amplitude = getInputData(effector_input_length + 0);
|
||||
frequency = getInputData(effector_input_length + 1);
|
||||
mulpSpd = getInputData(effector_input_length + 2);
|
||||
}
|
||||
|
||||
function onAffect(part, str) {
|
||||
var _sten = getInputData(5);
|
||||
|
||||
var _amp = getInputData(effector_input_length + 0);
|
||||
var _fre = getInputData(effector_input_length + 1);
|
||||
var _mls = getInputData(effector_input_length + 2);
|
||||
|
||||
var _lif = part.life;
|
||||
var _dir = part.spVec[1] + 90;
|
||||
|
||||
var _aamp = sin(part.seed + _lif * _fre) * _amp;
|
||||
if(_mls) _aamp *= part.spVec[0];
|
||||
var _aamp = sin(part.seed + _lif * frequency) * amplitude;
|
||||
if(mulpSpd) _aamp *= part.spVec[0];
|
||||
|
||||
var _dx = lengthdir_x(_aamp, _dir);
|
||||
var _dy = lengthdir_y(_aamp, _dir);
|
||||
|
||||
part.drawx += _dx;
|
||||
part.drawy += _dy;
|
||||
part.drawx += lengthdir_x(_aamp, _dir);
|
||||
part.drawy += lengthdir_y(_aamp, _dir);
|
||||
}
|
||||
}
|
|
@ -5,27 +5,23 @@ function Node_VFX_Repel(_x, _y, _group = noone) : Node_VFX_effector(_x, _y, _gro
|
|||
inputs[4].setVisible(false, false);
|
||||
|
||||
function onAffect(part, str) {
|
||||
var _area = getInputData(1);
|
||||
var _area_x = _area[0];
|
||||
var _area_y = _area[1];
|
||||
|
||||
var _sten = getInputData(5);
|
||||
var _rot_range = getInputData(6);
|
||||
var _sca_range = getInputData(7);
|
||||
var _rot = random_range(_rot_range[0], _rot_range[1]);
|
||||
var _sca = [ random_range(_sca_range[0], _sca_range[1]), random_range(_sca_range[2], _sca_range[3]) ];
|
||||
var _rot = random_range(rotateX, rotateY);
|
||||
var _scX = random_range(scaleX0, scaleX1);
|
||||
var _scY = random_range(scaleY0, scaleY1);
|
||||
|
||||
var pv = part.getPivot();
|
||||
var dirr = point_direction(_area_x, _area_y, pv[0], pv[1]);
|
||||
part.x = part.x + lengthdir_x(_sten * str, dirr);
|
||||
part.y = part.y + lengthdir_y(_sten * str, dirr);
|
||||
var dirr = point_direction(area_x, area_y, pv[0], pv[1]);
|
||||
part.x = part.x + lengthdir_x(strength * str, dirr);
|
||||
part.y = part.y + lengthdir_y(strength * str, dirr);
|
||||
|
||||
part.rot += _rot * str;
|
||||
|
||||
var scx_s = _sca[0] * str;
|
||||
var scy_s = _sca[1] * str;
|
||||
var scx_s = _scX * str;
|
||||
var scy_s = _scY * str;
|
||||
|
||||
if(scx_s < 0) part.scx = lerp_linear(part.scx, 0, abs(scx_s));
|
||||
else part.scx += sign(part.scx) * scx_s;
|
||||
|
||||
if(scy_s < 0) part.scy = lerp_linear(part.scy, 0, abs(scy_s));
|
||||
else part.scy += sign(part.scy) * scy_s;
|
||||
}
|
||||
|
|
|
@ -10,30 +10,32 @@ function Node_VFX_Turbulence(_x, _y, _group = noone) : Node_VFX_effector(_x, _y,
|
|||
|
||||
array_push(input_display_list, effector_input_length + 0, effector_input_length + 1);
|
||||
|
||||
tscale = 1;
|
||||
conspd = false;
|
||||
|
||||
static onVFXUpdate = function(frame = CURRENT_FRAME) {
|
||||
tscale = getInputData(effector_input_length + 0);
|
||||
conspd = getInputData(effector_input_length + 1);
|
||||
}
|
||||
|
||||
function onAffect(part, str) {
|
||||
var _sten = getInputData(5);
|
||||
var _rot_range = getInputData(6);
|
||||
var _sca_range = getInputData(7);
|
||||
var _rot = random_range(_rot_range[0], _rot_range[1]);
|
||||
var _sca = [ random_range(_sca_range[0], _sca_range[1]), random_range(_sca_range[2], _sca_range[3]) ];
|
||||
var _rot = random_range(rotateX, rotateY);
|
||||
var _scX = random_range(scaleX0, scaleX1);
|
||||
var _scY = random_range(scaleY0, scaleY1);
|
||||
|
||||
var pv = part.getPivot();
|
||||
var _seed = conspd? seed : part.seed;
|
||||
|
||||
var t_scale = getInputData(effector_input_length + 0);
|
||||
var con_sed = getInputData(effector_input_length + 1);
|
||||
var perx = (perlin_noise(pv[0] / tscale, pv[1] / tscale, 1, _seed) - 0.5) * 2;
|
||||
var pery = (perlin_noise(pv[0] / tscale, pv[1] / tscale, 1, _seed + 100) - 0.5) * 2;
|
||||
|
||||
var _seed = con_sed? seed : part.seed;
|
||||
|
||||
var perx = (perlin_noise(pv[0] / t_scale, pv[1] / t_scale, 1, _seed) - 0.5) * 2;
|
||||
var pery = (perlin_noise(pv[0] / t_scale, pv[1] / t_scale, 1, _seed + 100) - 0.5) * 2;
|
||||
|
||||
part.x += perx * str * _sten;
|
||||
part.y += pery * str * _sten;
|
||||
part.x += perx * str * strength;
|
||||
part.y += pery * str * strength;
|
||||
|
||||
part.rot += _rot * perx;
|
||||
|
||||
var scx_s = _sca[0] * str;
|
||||
var scy_s = _sca[1] * str;
|
||||
var scx_s = _scX * str;
|
||||
var scy_s = _scY * str;
|
||||
|
||||
if(scx_s < 0) part.scx = lerp_linear(part.scx, 0, abs(scx_s));
|
||||
else if(scx_s > 0) part.scx += sign(part.scx) * scx_s;
|
||||
|
|
|
@ -12,41 +12,43 @@ function Node_VFX_Vortex(_x, _y, _group = noone) : Node_VFX_effector(_x, _y, _gr
|
|||
|
||||
array_push(input_display_list, effector_input_length + 0, effector_input_length + 1, effector_input_length + 2);
|
||||
|
||||
attraction = 0;
|
||||
clockwise = 0;
|
||||
destroydis = false;
|
||||
|
||||
static onVFXUpdate = function(frame = CURRENT_FRAME) {
|
||||
attraction = getInputData(effector_input_length + 0);
|
||||
clockwise = getInputData(effector_input_length + 1);
|
||||
destroydis = getInputData(effector_input_length + 2);
|
||||
}
|
||||
|
||||
function onAffect(part, str) {
|
||||
var _area = getInputData(1);
|
||||
var _area_x = _area[0];
|
||||
var _area_y = _area[1];
|
||||
|
||||
var _sten = getInputData(5);
|
||||
var _rot_range = getInputData(6);
|
||||
var _sca_range = getInputData(7);
|
||||
var _attr = getInputData(effector_input_length + 0);
|
||||
var _clkw = getInputData(effector_input_length + 1);
|
||||
var _dest = getInputData(effector_input_length + 2);
|
||||
|
||||
var _rot = random_range(_rot_range[0], _rot_range[1]);
|
||||
var _sca = [ random_range(_sca_range[0], _sca_range[1]), random_range(_sca_range[2], _sca_range[3]) ];
|
||||
var _rot = random_range(rotateX, rotateY);
|
||||
var _scX = random_range(scaleX0, scaleX1);
|
||||
var _scY = random_range(scaleY0, scaleY1);
|
||||
|
||||
var pv = part.getPivot();
|
||||
|
||||
var dirr = point_direction(_area_x, _area_y, pv[0], pv[1]) + (_clkw? 90 : -90);
|
||||
part.x += lengthdir_x(_sten * str, dirr);
|
||||
part.y += lengthdir_y(_sten * str, dirr);
|
||||
var dirr = point_direction(area_x, area_y, pv[0], pv[1]) + (clockwise? 90 : -90);
|
||||
part.x += lengthdir_x(strength * str, dirr);
|
||||
part.y += lengthdir_y(strength * str, dirr);
|
||||
|
||||
var dirr = point_direction(pv[0], pv[1], _area_x, _area_y);
|
||||
part.x += lengthdir_x(_attr * str, dirr);
|
||||
part.y += lengthdir_y(_attr * str, dirr);
|
||||
var dirr = point_direction(pv[0], pv[1], area_x, area_y);
|
||||
part.x += lengthdir_x(attraction * str, dirr);
|
||||
part.y += lengthdir_y(attraction * str, dirr);
|
||||
|
||||
part.rot += _rot * str;
|
||||
|
||||
var scx_s = _sca[0] * str;
|
||||
var scy_s = _sca[1] * str;
|
||||
var scx_s = _scX * str;
|
||||
var scy_s = _scY * str;
|
||||
|
||||
if(scx_s < 0) part.scx = lerp_linear(part.scx, 0, abs(scx_s));
|
||||
else part.scx += sign(part.scx) * scx_s;
|
||||
|
||||
if(scy_s < 0) part.scy = lerp_linear(part.scy, 0, abs(scy_s));
|
||||
else part.scy += sign(part.scy) * scy_s;
|
||||
|
||||
if(_dest && point_distance(pv[0], pv[1], _area_x, _area_y) <= 1)
|
||||
if(destroydis && point_distance(pv[0], pv[1], area_x, area_y) <= 1)
|
||||
part.kill();
|
||||
}
|
||||
}
|
|
@ -3,22 +3,21 @@ function Node_VFX_Wind(_x, _y, _group = noone) : Node_VFX_effector(_x, _y, _grou
|
|||
node_draw_icon = s_node_vfx_wind;
|
||||
|
||||
function onAffect(part, str) {
|
||||
var _vect = getInputData(4);
|
||||
var _sten = getInputData(5);
|
||||
var _rot_range = getInputData(6);
|
||||
var _sca_range = getInputData(7);
|
||||
var _rot = random_range(_rot_range[0], _rot_range[1]);
|
||||
var _sca = [ random_range(_sca_range[0], _sca_range[1]), random_range(_sca_range[2], _sca_range[3]) ];
|
||||
var _rot = random_range(rotateX, rotateY);
|
||||
var _scX = random_range(scaleX0, scaleX1);
|
||||
var _scY = random_range(scaleY0, scaleY1);
|
||||
|
||||
part.x = part.x + _vect[0] * _sten * str;
|
||||
part.y = part.y + _vect[1] * _sten * str;
|
||||
part.x = part.x + effectVx * strength * str;
|
||||
part.y = part.y + effectVy * strength * str;
|
||||
|
||||
part.rot += _rot * str;
|
||||
|
||||
var scx_s = _sca[0] * str;
|
||||
var scy_s = _sca[1] * str;
|
||||
var scx_s = _scX * str;
|
||||
var scy_s = _scY * str;
|
||||
|
||||
if(scx_s < 0) part.scx = lerp_linear(part.scx, 0, abs(scx_s));
|
||||
else part.scx += sign(part.scx) * scx_s;
|
||||
|
||||
if(scy_s < 0) part.scy = lerp_linear(part.scy, 0, abs(scy_s));
|
||||
else part.scy += sign(part.scy) * scy_s;
|
||||
}
|
||||
|
|
|
@ -414,7 +414,7 @@ function __initNodes() {
|
|||
addNodeObject(vfx, "VFX Trail", s_node_vfx_trail, "Node_VFX_Trail", [1, Node_VFX_Trail],, "Generate path from particle movement.").hideRecent().setVersion(11560);
|
||||
addNodeObject(vfx, "VFX Triangulate", s_node_vfx_triangulate, "Node_VFX_Triangulate", [1, Node_VFX_Triangulate],, "Render line between particles.").hideRecent().setVersion(11670);
|
||||
|
||||
ds_list_add(vfx, "Instance control");
|
||||
ds_list_add(vfx, "Variables");
|
||||
addNodeObject(vfx, "VFX Variable", s_node_vfx_variable, "Node_VFX_Variable", [1, Node_VFX_Variable],, "Extract variable from particle objects.").hideRecent().setVersion(1120);
|
||||
addNodeObject(vfx, "VFX Override", s_node_vfx_override, "Node_VFX_Override", [1, Node_VFX_Override],, "Replace particle variable with a new one.").hideRecent().setVersion(1120);
|
||||
#endregion
|
||||
|
@ -434,9 +434,9 @@ function __initNodes() {
|
|||
addNodeObject(rigidSim, "Wall", s_node_rigidSim_wall, "Node_Rigid_Wall", [1, Node_Rigid_Wall]).hideRecent().setVersion(11680);
|
||||
addNodeObject(rigidSim, "Render", s_node_rigidSim_renderer, "Node_Rigid_Render", [1, Node_Rigid_Render],, "Render rigidbody object to surface.").hideRecent().setVersion(1110);
|
||||
addNodeObject(rigidSim, "Apply Force", s_node_rigidSim_force, "Node_Rigid_Force_Apply", [1, Node_Rigid_Force_Apply],, "Apply force to objects.").hideRecent().setVersion(1110);
|
||||
|
||||
ds_list_add(rigidSim, "Instance control");
|
||||
addNodeObject(rigidSim, "Activate Physics", s_node_rigidSim_activate, "Node_Rigid_Activate", [1, Node_Rigid_Activate],, "Enable or disable rigidbody object.").hideRecent().setVersion(1110);
|
||||
|
||||
ds_list_add(rigidSim, "Variables");
|
||||
addNodeObject(rigidSim, "Rigidbody Variable", s_node_rigid_variable, "Node_Rigid_Variable", [1, Node_Rigid_Variable],, "Extract veriable from rigidbody object.").hideRecent().setVersion(1120);
|
||||
addNodeObject(rigidSim, "Rigidbody Override", s_node_rigid_override, "Node_Rigid_Override", [1, Node_Rigid_Override],, "Replace rigidbody object variable with a new one.").hideRecent().setVersion(1120);
|
||||
#endregion
|
||||
|
|
Loading…
Reference in a new issue