| 492 | } |
| 493 | |
| 494 | void ModelRigid(Vector3i* segment, Vector3i* nextSegment, Vector3i* velocity, Vector3i* nextVelocity, int length) |
| 495 | { |
| 496 | Vector3i vec; |
| 497 | vec.x = nextSegment->x + nextVelocity->x - segment->x - velocity->x; |
| 498 | vec.y = nextSegment->y + nextVelocity->y - segment->y - velocity->y; |
| 499 | vec.z = nextSegment->z + nextVelocity->z - segment->z - velocity->z; |
| 500 | |
| 501 | int result = (65536 * sqrt(abs(pow(vec.x >> FP_SHIFT, 2) + pow(vec.y >> FP_SHIFT, 2) + pow(vec.z >> FP_SHIFT, 2))) - length) / 2; |
| 502 | NormaliseRopeVector(&vec); |
| 503 | |
| 504 | vec.x = (int64_t)result * vec.x >> FP_SHIFT; |
| 505 | vec.y = (int64_t)result * vec.y >> FP_SHIFT; |
| 506 | vec.z = (int64_t)result * vec.z >> FP_SHIFT; |
| 507 | |
| 508 | velocity->x += vec.x; |
| 509 | velocity->y += vec.y; |
| 510 | velocity->z += vec.z; |
| 511 | |
| 512 | nextVelocity->x -= vec.x; |
| 513 | nextVelocity->y -= vec.y; |
| 514 | nextVelocity->z -= vec.z; |
| 515 | } |
| 516 | |
| 517 | void UpdateRopeSwing(ItemInfo* item) |
| 518 | { |
no test coverage detected