use of com.talosvfx.talos.runtime.values.NumericalValue in project talos by rockbite.
the class AbstractModule method createInputSlot.
public NumericalValue createInputSlot(int slotId) {
inputSlots.put(slotId, new Slot(this, slotId, true));
NumericalValue value = new NumericalValue();
inputSlots.get(slotId).setValue(value);
return value;
}
use of com.talosvfx.talos.runtime.values.NumericalValue in project talos by rockbite.
the class AttractorModule method processValues.
@Override
public void processValues() {
NumericalValue posNumVal = getScope().get(ScopePayload.PARTICLE_POSITION);
pos.set(posNumVal.get(0), posNumVal.get(1));
float alphaVal = getScope().getFloat(ScopePayload.PARTICLE_ALPHA);
;
if (!alpha.isEmpty()) {
alphaVal = alpha.getFloat();
}
initialVector.set(initialVelocity.getFloat(), 0);
initialVector.rotate(initialAngle.getFloat());
attractionVector.set(attractorPosition.get(0), attractorPosition.get(1)).sub(pos);
attractionVector.nor().scl(initialVelocity.getFloat());
Interpolation interpolation = Interpolation.linear;
// now let's mix them
result.set(interpolation.apply(initialVector.x, attractionVector.x, alphaVal), interpolation.apply(initialVector.y, attractionVector.y, alphaVal));
angle.set(result.angle());
velocity.set(result.len());
}
Aggregations