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

Method updateFroth

Engine/source/T3D/player.cpp:7137–7180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7135//--------------------------------------------------------------------------
7136
7137void Player::updateFroth( F32 dt )
7138{
7139 // update bubbles
7140 Point3F moveDir = getVelocity();
7141 mBubbleEmitterTime += dt;
7142
7143 if (mBubbleEmitterTime < mDataBlock->bubbleEmitTime) {
7144 if (mSplashEmitter[PlayerData::BUBBLE_EMITTER]) {
7145 Point3F emissionPoint = getRenderPosition();
7146 U32 emitNum = PlayerData::BUBBLE_EMITTER;
7147 mSplashEmitter[emitNum]->emitParticles(mLastPos, emissionPoint,
7148 Point3F( 0.0, 0.0, 1.0 ), moveDir, (U32)(dt * 1000.0));
7149 }
7150 }
7151
7152 Point3F contactPoint;
7153 if (!collidingWithWater(contactPoint)) {
7154 mLastWaterPos = mLastPos;
7155 return;
7156 }
7157
7158 F32 speed = moveDir.len();
7159 if ( speed < mDataBlock->splashVelEpsilon )
7160 speed = 0.0;
7161
7162 U32 emitRate = (U32) (speed * mDataBlock->splashFreqMod * dt);
7163
7164 // If we're in the water, swimming, but not
7165 // moving, then lets emit some particles because
7166 // we're treading water.
7167 if ( mSwimming && speed == 0.0 )
7168 {
7169 emitRate = (U32) (2.0f * mDataBlock->splashFreqMod * dt);
7170 }
7171
7172 U32 i;
7173 for ( i=0; i<PlayerData::BUBBLE_EMITTER; i++ ) {
7174 if (mSplashEmitter[i] )
7175 mSplashEmitter[i]->emitParticles( mLastWaterPos,
7176 contactPoint, Point3F( 0.0, 0.0, 1.0 ),
7177 moveDir, emitRate );
7178 }
7179 mLastWaterPos = contactPoint;
7180}
7181
7182void Player::updateWaterSounds(F32 dt)
7183{

Callers

nothing calls this directly

Calls 4

getVelocityFunction · 0.85
Point3FClass · 0.50
emitParticlesMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected