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

Method init_constraints

Engine/source/afx/afxMagicSpell.cpp:1431–1487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1429}
1430
1431void afxMagicSpell::init_constraints()
1432{
1433 if (mConstraints_initialized)
1434 {
1435 //Con::printf("CONSTRAINTS ALREADY INITIALIZED");
1436 return;
1437 }
1438
1439 Vector<afxConstraintDef> defs;
1440 mDatablock->gatherConstraintDefs(defs);
1441
1442 constraint_mgr->initConstraintDefs(defs, isServerObject());
1443
1444 if (isServerObject())
1445 {
1446 mCaster_cons_id = constraint_mgr->setReferenceObject(CASTER_CONS, mCaster);
1447 mTarget_cons_id = constraint_mgr->setReferenceObject(TARGET_CONS, mTarget);
1448#if defined(AFX_CAP_SCOPE_TRACKING)
1449 if (mCaster && mCaster->isScopeable())
1450 constraint_mgr->addScopeableObject(mCaster);
1451
1452 if (mTarget && mTarget->isScopeable())
1453 constraint_mgr->addScopeableObject(mTarget);
1454#endif
1455
1456 // find local camera
1457 mCamera_cons_obj = get_camera();
1458 if (mCamera_cons_obj)
1459 mCamera_cons_id = constraint_mgr->setReferenceObject(CAMERA_CONS, mCamera_cons_obj);
1460 }
1461 else // if (isClientObject())
1462 {
1463 if (mCaster)
1464 mCaster_cons_id = constraint_mgr->setReferenceObject(CASTER_CONS, mCaster);
1465 else if (mCaster_scope_id > 0)
1466 mCaster_cons_id = constraint_mgr->setReferenceObjectByScopeId(CASTER_CONS, mCaster_scope_id, true);
1467
1468 if (mTarget)
1469 mTarget_cons_id = constraint_mgr->setReferenceObject(TARGET_CONS, mTarget);
1470 else if (mTarget_scope_id > 0)
1471 mTarget_cons_id = constraint_mgr->setReferenceObjectByScopeId(TARGET_CONS, mTarget_scope_id, mTarget_is_shape);
1472
1473 // find local camera
1474 mCamera_cons_obj = get_camera();
1475 if (mCamera_cons_obj)
1476 mCamera_cons_id = constraint_mgr->setReferenceObject(CAMERA_CONS, mCamera_cons_obj);
1477
1478 // find local listener
1479 Point3F listener_pos;
1480 listener_pos = SFX->getListener().getTransform().getPosition();
1481 mListener_cons_id = constraint_mgr->setReferencePoint(LISTENER_CONS, listener_pos);
1482 }
1483
1484 constraint_mgr->adjustProcessOrdering(this);
1485
1486 mConstraints_initialized = true;
1487}
1488

Callers

nothing calls this directly

Calls 11

initConstraintDefsMethod · 0.80
isScopeableMethod · 0.80
addScopeableObjectMethod · 0.80
getListenerMethod · 0.80
adjustProcessOrderingMethod · 0.80
setReferencePointMethod · 0.60
gatherConstraintDefsMethod · 0.45
setReferenceObjectMethod · 0.45
getPositionMethod · 0.45
getTransformMethod · 0.45

Tested by

no test coverage detected