Physx fluid note Transmitter

Source: Internet
Author: User

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);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.