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

Method blowUp

Engine/source/T3D/shapeBase.cpp:1906–1989  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1904//----------------------------------------------------------------------------
1905
1906void ShapeBase::blowUp()
1907{
1908 Point3F center;
1909 mObjBox.getCenter(&center);
1910 center += getPosition();
1911 MatrixF trans = getTransform();
1912 trans.setPosition( center );
1913
1914 // explode
1915 Explosion* pExplosion = NULL;
1916
1917 if( pointInWater( (Point3F &)center ) && mDataBlock->underwaterExplosion )
1918 {
1919 pExplosion = new Explosion;
1920 pExplosion->onNewDataBlock(mDataBlock->underwaterExplosion, false);
1921 }
1922 else
1923 {
1924 if (mDataBlock->explosion)
1925 {
1926 pExplosion = new Explosion;
1927 pExplosion->onNewDataBlock(mDataBlock->explosion, false);
1928 }
1929 }
1930
1931 if( pExplosion )
1932 {
1933 pExplosion->setTransform(trans);
1934 pExplosion->setInitialState(center, damageDir);
1935 if (pExplosion->registerObject() == false)
1936 {
1937 Con::errorf(ConsoleLogEntry::General, "ShapeBase(%s)::explode: couldn't register explosion",
1938 mDataBlock->getName() );
1939 delete pExplosion;
1940 pExplosion = NULL;
1941 }
1942 }
1943
1944 TSShapeInstance *debShape = NULL;
1945
1946 if( mDataBlock->mDebrisShape == NULL )
1947 {
1948 return;
1949 }
1950 else
1951 {
1952 debShape = new TSShapeInstance( mDataBlock->mDebrisShape, true);
1953 }
1954
1955
1956 Vector< TSPartInstance * > partList;
1957 TSPartInstance::breakShape( debShape, 0, partList, NULL, NULL, 0 );
1958
1959 if( !mDataBlock->debris )
1960 {
1961 mDataBlock->debris = new DebrisData;
1962 }
1963

Callers 1

shapeBase.cppFile · 0.80

Calls 15

getPositionFunction · 0.85
randomDirFunction · 0.85
setPartInstanceMethod · 0.80
incDebrisRefCountMethod · 0.80
errorfFunction · 0.50
warnfFunction · 0.50
getCenterMethod · 0.45
setPositionMethod · 0.45
onNewDataBlockMethod · 0.45
setTransformMethod · 0.45
setInitialStateMethod · 0.45
registerObjectMethod · 0.45

Tested by

no test coverage detected