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

Method applyRadialImpulse

Engine/source/forest/forest.cpp:305–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303}
304
305void Forest::applyRadialImpulse( const Point3F &origin, F32 radius, F32 magnitude )
306{
307 if ( isServerObject() )
308 return;
309
310 // Find all the trees in the radius
311 // then get their accumulators and
312 // push our impulse into them.
313 VectorF impulse( 0, 0, 0 );
314 ForestWindAccumulator *accumulator = NULL;
315
316 Vector<TreePlacementInfo> trees;
317 getLocalWindTrees( origin, radius, &trees );
318 for ( U32 i = 0; i < trees.size(); i++ )
319 {
320 const TreePlacementInfo &treeInfo = trees[i];
321 accumulator = WINDMGR->getLocalWind( treeInfo.itemKey );
322 if ( !accumulator )
323 continue;
324
325 impulse = treeInfo.pos - origin;
326 impulse.normalize();
327 impulse *= magnitude;
328
329 accumulator->applyImpulse( impulse );
330 }
331}
332
333void Forest::createNewFile()
334{

Callers

nothing calls this directly

Calls 4

getLocalWindMethod · 0.80
sizeMethod · 0.45
normalizeMethod · 0.45
applyImpulseMethod · 0.45

Tested by

no test coverage detected