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

Method playImpactSound

Engine/source/T3D/player.cpp:7063–7096  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7061}
7062
7063void Player:: playImpactSound()
7064{
7065 if( mWaterCoverage == 0.0f )
7066 {
7067 Point3F pos;
7068 RayInfo rInfo;
7069 MatrixF mat = getTransform();
7070 mat.mulP(Point3F(mDataBlock->decalOffset,0.0f,0.0f), &pos);
7071
7072 if( gClientContainer.castRay( Point3F( pos.x, pos.y, pos.z + 0.01f ),
7073 Point3F( pos.x, pos.y, pos.z - 2.0f ),
7074 STATIC_COLLISION_TYPEMASK | VehicleObjectType,
7075 &rInfo ) )
7076 {
7077 Material* material = ( rInfo.material ? dynamic_cast< Material* >( rInfo.material->getMaterial() ) : 0 );
7078
7079 if( material && material->getCustomImpactSoundProfile() )
7080 SFX->playOnce( material->getCustomImpactSoundProfile(), &getTransform() );
7081 else
7082 {
7083 S32 sound = -1;
7084 if (material && (material->mImpactSoundId > -1 && material->mImpactSoundId < PlayerData::WaterStart))
7085 sound = material->mImpactSoundId;
7086 else if( rInfo.object->getTypeMask() & VehicleObjectType )
7087 sound = 2; // Play metal;
7088
7089 if (sound >= 0)
7090 SFX->playOnce(mDataBlock->getPlayerSoundProfile(PlayerData::ImpactSoft + sound), &getTransform());
7091 }
7092 }
7093 }
7094
7095 mImpactSound = 0;
7096}
7097
7098//--------------------------------------------------------------------------
7099// Update splash

Callers

nothing calls this directly

Calls 6

mulPMethod · 0.80
getTypeMaskMethod · 0.80
Point3FClass · 0.50
castRayMethod · 0.45
getMaterialMethod · 0.45
playOnceMethod · 0.45

Tested by

no test coverage detected