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

Method _updatePhysics

Engine/source/T3D/tsStatic.cpp:553–578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

551}
552
553void TSStatic::_updatePhysics()
554{
555 SAFE_DELETE(mPhysicsRep);
556
557 if (!PHYSICSMGR || mCollisionType == None)
558 return;
559
560 PhysicsCollision* colShape = NULL;
561 if (mCollisionType == Bounds)
562 {
563 MatrixF offset(true);
564 offset.setPosition(mShape->center);
565 colShape = PHYSICSMGR->createCollision();
566 colShape->addBox(getObjBox().getExtents() * 0.5f * mObjScale, offset);
567 }
568 else
569 colShape = mShape->buildColShape(mCollisionType == VisibleMesh, getScale());
570
571 if (colShape)
572 {
573 PhysicsWorld* world = PHYSICSMGR->getWorld(isServerObject() ? "server" : "client");
574 mPhysicsRep = PHYSICSMGR->createBody();
575 mPhysicsRep->init(colShape, 0, 0, this, world);
576 mPhysicsRep->setTransform(getTransform());
577 }
578}
579
580void TSStatic::onRemove()
581{

Callers

nothing calls this directly

Calls 9

getExtentsMethod · 0.80
buildColShapeMethod · 0.80
setPositionMethod · 0.45
createCollisionMethod · 0.45
addBoxMethod · 0.45
getWorldMethod · 0.45
createBodyMethod · 0.45
initMethod · 0.45
setTransformMethod · 0.45

Tested by

no test coverage detected