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

Method set_ref_shape

Engine/source/afx/afxConstraint.cpp:534–569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

532}
533
534void afxConstraintMgr::set_ref_shape(afxConstraintID id, ShapeBase* shape)
535{
536 id.sub_index = 0;
537
538 afxShapeConstraint* shape_cons = dynamic_cast<afxShapeConstraint*>(CONS_BY_ID(id));
539
540 // need to change type
541 if (!shape_cons)
542 {
543 afxConstraint* cons = CONS_BY_ID(id);
544 shape_cons = newShapeCons(this, cons->mCons_def.mHistory_time > 0.0f);
545 shape_cons->mCons_def = cons->mCons_def;
546 CONS_BY_ID(id) = shape_cons;
547 delete cons;
548 }
549
550 // set new shape on root
551 shape_cons->set(shape);
552
553 // update all subnodes
554 for (S32 j = 1; j < (*mConstraints_v[id.index]).size(); j++)
555 {
556 afxConstraint* cons = CONS_BY_IJ(id.index,j);
557 if (cons)
558 {
559 if (dynamic_cast<afxShapeNodeConstraint*>(cons))
560 ((afxShapeNodeConstraint*)cons)->set(shape);
561 else if (dynamic_cast<afxShapeConstraint*>(cons))
562 ((afxShapeConstraint*)cons)->set(shape);
563 else if (dynamic_cast<afxObjectConstraint*>(cons))
564 ((afxObjectConstraint*)cons)->set(shape);
565 else
566 cons->unset();
567 }
568 }
569}
570
571void afxConstraintMgr::set_ref_shape(afxConstraintID id, U16 scope_id)
572{

Callers

nothing calls this directly

Calls 5

newShapeConsFunction · 0.85
setMethod · 0.45
sizeMethod · 0.45
unsetMethod · 0.45
set_scope_idMethod · 0.45

Tested by

no test coverage detected