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

Method onAdd

Engine/source/T3D/item.cpp:342–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

340//----------------------------------------------------------------------------
341
342bool Item::onAdd()
343{
344 if (!Parent::onAdd() || !mDataBlock)
345 return false;
346
347 if (mStatic)
348 mAtRest = true;
349 mObjToWorld.getColumn(3,&mDelta.pos);
350
351 // Setup the box for our convex object...
352 mObjBox.getCenter(&mConvex.mCenter);
353 mConvex.mSize.x = mObjBox.len_x() / 2.0;
354 mConvex.mSize.y = mObjBox.len_y() / 2.0;
355 mConvex.mSize.z = mObjBox.len_z() / 2.0;
356 mWorkingQueryBox.minExtents.set(-1e9, -1e9, -1e9);
357 mWorkingQueryBox.maxExtents.set(-1e9, -1e9, -1e9);
358
359 if( !isHidden() && !mSubclassItemHandlesScene )
360 addToScene();
361
362 if (isServerObject())
363 {
364 if (!mSubclassItemHandlesScene)
365 scriptOnAdd();
366 }
367 else if (mDataBlock->lightType != NoLight)
368 {
369 mDropTime = Sim::getCurrentTime();
370 }
371
372 _updatePhysics();
373
374 return true;
375}
376
377void Item::_updatePhysics()
378{

Callers

nothing calls this directly

Calls 8

isHiddenFunction · 0.85
getColumnMethod · 0.80
getCurrentTimeFunction · 0.50
getCenterMethod · 0.45
len_xMethod · 0.45
len_yMethod · 0.45
len_zMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected