moisesjpelaez - Physics Private Fields

This commit is contained in:
2025-06-01 23:02:50 +00:00
parent 32cdbd8c54
commit a6d9cb9201

View File

@ -24,43 +24,43 @@ class SetParticleDataNode extends LogicNode {
switch (property0) { switch (property0) {
case 'Particle Size': case 'Particle Size':
psys.r.particle_size = inputs[3].get(); @:privateAccess psys.r.particle_size = inputs[3].get();
case 'Frame Start': case 'Frame Start':
psys.r.frame_start = inputs[3].get(); @:privateAccess psys.r.frame_start = inputs[3].get();
psys.animtime = (psys.r.frame_end - psys.r.frame_start) / psys.frameRate; @:privateAccess psys.animtime = (@:privateAccess psys.r.frame_end - @:privateAccess psys.r.frame_start) / @:privateAccess psys.frameRate;
psys.spawnRate = ((psys.r.frame_end - psys.r.frame_start) / psys.count) / psys.frameRate; @:privateAccess psys.spawnRate = ((@:privateAccess psys.r.frame_end - @:privateAccess psys.r.frame_start) / @:privateAccess psys.count) / @:privateAccess psys.frameRate;
case 'Frame End': case 'Frame End':
psys.r.frame_end = inputs[3].get(); @:privateAccess psys.r.frame_end = inputs[3].get();
psys.animtime = (psys.r.frame_end - psys.r.frame_start) / psys.frameRate; @:privateAccess psys.animtime = (@:privateAccess psys.r.frame_end - @:privateAccess psys.r.frame_start) / @:privateAccess psys.frameRate;
psys.spawnRate = ((psys.r.frame_end - psys.r.frame_start) / psys.count) / psys.frameRate; @:privateAccess psys.spawnRate = ((@:privateAccess psys.r.frame_end - @:privateAccess psys.r.frame_start) / @:privateAccess psys.count) / @:privateAccess psys.frameRate;
case 'Lifetime': case 'Lifetime':
psys.lifetime = inputs[3].get() / psys.frameRate; @:privateAccess psys.lifetime = inputs[3].get() / @:privateAccess psys.frameRate;
case 'Lifetime Random': case 'Lifetime Random':
psys.r.lifetime_random = inputs[3].get(); @:privateAccess psys.r.lifetime_random = inputs[3].get();
case 'Emit From': case 'Emit From':
var emit_from: Int = inputs[3].get(); var emit_from: Int = inputs[3].get();
if (emit_from == 0 || emit_from == 1 || emit_from == 2) { if (emit_from == 0 || emit_from == 1 || emit_from == 2) {
psys.r.emit_from = emit_from; @:privateAccess psys.r.emit_from = emit_from;
psys.setupGeomGpu(mo.particleChildren != null ? mo.particleChildren[slot] : cast(iron.Scene.active.getChild(psys.data.raw.instance_object), iron.object.MeshObject), mo); @:privateAccess psys.setupGeomGpu(mo.particleChildren != null ? mo.particleChildren[slot] : cast(iron.Scene.active.getChild(psys.data.raw.instance_object), iron.object.MeshObject), mo);
} }
case 'Velocity': case 'Velocity':
var vel: iron.math.Vec3 = inputs[3].get(); var vel: iron.math.Vec3 = inputs[3].get();
psys.alignx = vel.x / 2; @:privateAccess psys.alignx = vel.x / 2;
psys.aligny = vel.y / 2; @:privateAccess psys.aligny = vel.y / 2;
psys.alignz = vel.z / 2; @:privateAccess psys.alignz = vel.z / 2;
case 'Velocity Random': case 'Velocity Random':
psys.r.factor_random = inputs[3].get(); psys.r.factor_random = inputs[3].get();
case 'Weight Gravity': case 'Weight Gravity':
psys.r.weight_gravity = inputs[3].get(); psys.r.weight_gravity = inputs[3].get();
if (iron.Scene.active.raw.gravity != null) { if (iron.Scene.active.raw.gravity != null) {
psys.gx = iron.Scene.active.raw.gravity[0] * psys.r.weight_gravity; @:privateAccess psys.gx = iron.Scene.active.raw.gravity[0] * @:privateAccess psys.r.weight_gravity;
psys.gy = iron.Scene.active.raw.gravity[1] * psys.r.weight_gravity; @:privateAccess psys.gy = iron.Scene.active.raw.gravity[1] * @:privateAccess psys.r.weight_gravity;
psys.gz = iron.Scene.active.raw.gravity[2] * psys.r.weight_gravity; @:privateAccess psys.gz = iron.Scene.active.raw.gravity[2] * @:privateAccess psys.r.weight_gravity;
} }
else { else {
psys.gx = 0; @:privateAccess psys.gx = 0;
psys.gy = 0; @:privateAccess psys.gy = 0;
psys.gz = -9.81 * psys.r.weight_gravity; @:privateAccess psys.gz = -9.81 * @:privateAccess psys.r.weight_gravity;
} }
case 'Speed': case 'Speed':
psys.speed = inputs[3].get(); psys.speed = inputs[3].get();