MCPcopy Create free account
hub / github.com/cinder/Cinder / handleCollision

Method handleCollision

samples/FallingGears/src/SceneObjects.cpp:55–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53// ----------------------------------------------------------------------------------------------------
54
55void Wall::handleCollision( const Gear *gear, const vec2 &contactPoint )
56{
57 const float maxVibration = 6.0f;
58
59 mVibrationLevel.stop();
60 mVibrationLevel = ( maxVibration + mVibrationLevel ) / 2;
61
62 app::timeline().apply( &mVibrationLevel, 0.0f, 1.0f );
63
64 float panPos;
65 float freqMidi = mFundamentalMidi;
66
67 if( mSide == Wall::Side::RIGHT ) {
68 freqMidi += 7;
69 panPos = 0.9f; // almost all the way to the right
70 }
71 else
72 panPos = 0.1f; // almost all the way to the left
73
74 while( freqMidi > BASS_MAX )
75 freqMidi -= 12;
76
77 // CI_LOG_V( "f0: " << mFundamentalMidi << ", freqMidi: " << freqMidi << ", bassMaxFreq: " << audio::midiToFreq( BASS_MAX ) << ", resulting bass note: " << audio::midiToFreq( freqMidi ) );
78
79 auto bassSynth = mAudio->getNextBassSynth();
80 bassSynth->setPan( panPos );
81 bassSynth->trigger( freqMidi, 2.0f );
82}
83
84void Wall::draw()
85{

Callers 2

handleIslandCollisionMethod · 0.45
handleWallCollisionMethod · 0.45

Calls 9

toCinderFunction · 0.85
EaseOutQuartClass · 0.85
getNextBassSynthMethod · 0.80
triggerMethod · 0.80
getNextAltoSynthMethod · 0.80
stopMethod · 0.45
applyMethod · 0.45
setPanMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected