MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / emitDust

Method emitDust

Engine/source/T3D/shapeBase.cpp:2529–2557  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2527/// and be emitted at the given offset from the contact point having a direction of 'axis'.
2528
2529void ShapeBase::emitDust( ParticleEmitter* emitter, F32 triggerHeight, const Point3F& offset, U32 numMilliseconds, const Point3F& axis )
2530{
2531 if( !emitter )
2532 return;
2533
2534 Point3F startPos = getPosition();
2535 Point3F endPos = startPos + Point3F( 0.0, 0.0, - triggerHeight );
2536
2537 RayInfo rayInfo;
2538 if( getContainer()->castRay( startPos, endPos, STATIC_COLLISION_TYPEMASK, &rayInfo ) )
2539 {
2540 Material* material = ( rayInfo.material ? dynamic_cast< Material* >( rayInfo.material->getMaterial() ) : 0 );
2541 if( material && material->mShowDust )
2542 {
2543 LinearColorF colorList[ ParticleData::PDC_NUM_KEYS ];
2544
2545 for( U32 x = 0; x < getMin( Material::NUM_EFFECT_COLOR_STAGES, ParticleData::PDC_NUM_KEYS ); ++ x )
2546 colorList[ x ] = material->mEffectColor[ x ];
2547 for( U32 x = Material::NUM_EFFECT_COLOR_STAGES; x < ParticleData::PDC_NUM_KEYS; ++ x )
2548 colorList[ x ].set( 1.0, 1.0, 1.0, 0.0 );
2549
2550 emitter->setColors( colorList );
2551
2552 Point3F contactPoint = rayInfo.point + offset;
2553 emitter->emitParticles( contactPoint, true, ( axis == Point3F::Zero ? rayInfo.normal : axis ),
2554 getVelocity(), numMilliseconds );
2555 }
2556 }
2557}
2558
2559//----------------------------------------------------------------------------
2560

Callers

nothing calls this directly

Calls 9

getPositionFunction · 0.85
getVelocityFunction · 0.85
setColorsMethod · 0.80
Point3FClass · 0.50
getContainerFunction · 0.50
castRayMethod · 0.45
getMaterialMethod · 0.45
setMethod · 0.45
emitParticlesMethod · 0.45

Tested by

no test coverage detected