The transmitter is used to directly create fluid particles to simulate faucets, nozzles, and bleeding wounds.
It has two modes:
First, the constant pressure (constant pressure), the pressure of the particle emission is fixed, and this simulation can be used to emit a line of water.
Second, the constant flow rate (Constant Flow Rate). The transmitter emits a fixed number of particles at each frame. By running nxfluidemitterdesc: rate, you can dynamically change the flow rate. The nx_fef_enabled flag of nxfluidemitterdesc enables or disables the transmitter.
Create a transmitter
You need an nxfluidemitterdesc, set the parameter, and then use this descriptor to call the nxfluid: createemitter () method to create it.
Several important parameters in nxfluidemitterdesc are briefly introduced:
The pose, position, and rotation of the relpose Transmitter
Type transmitter type, which can be constant pressure or flow rate, corresponding
Nx_pe_constant-pressure and nx_pe_constant_flow_rate
Shape of the Shape transmitter. The current version has two types: Square (nx_pe_rectangular) and elliptical
Circle (nx_pe_ellipse)
The lifetime of the particle emitted by the particle lelifetime transmitter, in seconds. If it is set to zero, the particle will survive until it is touched.
To drain (this word does not find a proper translation for the moment)
The maximum number of particles that can be emitted by a maxparticle transmitter. When the maximum number of particles is reached, the transmitter stops creating
Create a particle, and then re-launch it with a landing particle. Set it to 0, without limiting the number of particles to be emitted,
It emits until the maximum number of particles reaches fluid.
Rate the number of particles emitted per second. Valid only when nx_pe_constant_flow_rate
Dimensions of the dimensionx and dimensiony Transmitters
Sample Code
Create a transmitter
NxFluidEmitterDesc emitterDesc;
emitterDesc.setToDefault(); emitterDesc.dimensionX = 0.03; emitterDesc.dimensionY = 0.03;
emitterDesc.relPose.id(); NxReal mat[] = {1,0,0,0, 0,0,1,0, 0,-1,0,0, 0,2,0,1}; emitterDesc.relPose.setColumnMajor44(mat);
emitterDesc.rate = 5.0; emitterDesc.randomAngle = 0.1f; emitterDesc.fluidVelocityMagnitude = 6.5f; emitterDesc.maxParticles = MAX_PARTICLES; emitterDesc.particleLifetime = 4.0f; emitterDesc.type = NX_FE_CONSTANT_FLOW_RATE; emitterDesc.shape = NX_FE_ELLIPSE;
gFluidEmitter = gFluid->createEmitter(emitterDesc);