| 456 | } |
| 457 | |
| 458 | void 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 | |
| 496 | CPHJoint::CPHJoint(CPhysicsJoint::enumType type, CPhysicsElement* first, CPhysicsElement* second) |
| 497 | { |
no test coverage detected