MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / SetLimits

Method SetLimits

ogsr_engine/xrGame/PHJoint.cpp:458–494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

456}
457
458void CPHJoint::SetLimits(const float low, const float high, const int axis_num)
459{
460 if (!(pFirst_element && pSecond_element))
461 return;
462
463 int ax = axis_num;
464 LimitAxisNum(ax);
465 if (-1 == ax)
466 return;
467
468 Fvector axis;
469 switch (axes[ax].vs)
470 {
471 case vs_first: pFirst_element->mXFORM.transform_dir(axis, axes[ax].direction); break;
472 case vs_second: pSecond_element->mXFORM.transform_dir(axis, axes[ax].direction); break;
473 case vs_global:
474 default: axis.set(axes[ax].direction);
475 }
476
477 axes[ax].low = low;
478 axes[ax].high = high;
479 Fmatrix m1, m2;
480 m1.set(pFirst_element->mXFORM);
481 m1.invert();
482 m2.mul(m1, pSecond_element->mXFORM);
483 // m2.mul(pSecond_element->mXFORM,m1);
484
485 float zer;
486 // axis_angleB(m2,axis,zer);
487 axis_angleA(m2, axes[ax].direction, zer);
488
489 axes[ax].zero = zer;
490 // m2.invert();
491 // axes[ax].zero_transform.set(m2);
492 if (bActive)
493 SetLimitsActive(axis_num);
494}
495
496CPHJoint::CPHJoint(CPhysicsJoint::enumType type, CPhysicsElement* first, CPhysicsElement* second)
497{

Callers 3

AddElementRecursiveMethod · 0.80
BreakMethod · 0.80
AddElementMethod · 0.80

Calls 5

axis_angleAFunction · 0.85
transform_dirMethod · 0.45
setMethod · 0.45
invertMethod · 0.45
mulMethod · 0.45

Tested by

no test coverage detected