MCPcopy Create free account
hub / github.com/carbonengine/trinity / GetStartPosition

Method GetStartPosition

trinity/Eve/Turret/EveTurretFiringFX.cpp:323–349  ·  view source on GitHub ↗

-------------------------------------------------------------------------------- Description: Get the start position of this firing effect. This is most likely only an average, because the firing effects contains multiple beams from multiple muzzles. --------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

321// multiple muzzles.
322// --------------------------------------------------------------------------------
323bool EveTurretFiringFX::GetStartPosition( Vector3& pos ) const
324{
325 if( !m_isFiring )
326 {
327 return false;
328 }
329 // sum all of them up
330 Vector3 p = Vector3( 0.f, 0.f, 0.f );
331 uint32_t cntr = 0;
332 for( size_t i = 0; i < m_stretch.size(); ++i )
333 {
334 if( m_perMuzzleData[i].started )
335 {
336 p += m_perMuzzleData[i].muzzleTransform.GetTranslation();
337 ++cntr;
338 }
339 }
340 // did we get any?
341 if( cntr == 0 )
342 {
343 return false;
344 }
345
346 // devide and return
347 pos = p / (float)cntr;
348 return true;
349}
350
351// --------------------------------------------------------------------------------
352// Description:

Callers 1

UpdateSyncronousMethod · 0.80

Calls 3

sizeMethod · 0.80
GetTranslationMethod · 0.80
Vector3Class · 0.50

Tested by

no test coverage detected