| 490 | } |
| 491 | |
| 492 | static void TurnToFace(xEnt* ent, const xVec3* target, F32 speedLimit, F32 dt) |
| 493 | { |
| 494 | xVec3 currentFacing = ent->frame->mat.at; |
| 495 | xVec3Normalize(¤tFacing, ¤tFacing); |
| 496 | |
| 497 | F32 angle = xVec3Dot(¤tFacing, target); |
| 498 | const F32 maxAngle = 0.9999f; |
| 499 | if (angle < maxAngle) |
| 500 | { |
| 501 | xVec3Cross(&ent->frame->drot.axis, ¤tFacing, target); |
| 502 | xVec3Normalize(&ent->frame->drot.axis, &ent->frame->drot.axis); |
| 503 | |
| 504 | angle = xacos(angle); |
| 505 | if (angle > speedLimit * dt) |
| 506 | { |
| 507 | angle = speedLimit * dt; |
| 508 | } |
| 509 | |
| 510 | if (ent->frame->drot.axis.y < 0.0f) |
| 511 | { |
| 512 | angle = -angle; |
| 513 | } |
| 514 | |
| 515 | ent->frame->drot.angle = angle; |
| 516 | ent->frame->mode |= 0x20; |
| 517 | } |
| 518 | } |
| 519 | |
| 520 | void PlayerArrive(xEnt* ent, xBase* base) |
| 521 | { |
nothing calls this directly
no test coverage detected