| 3911 | } |
| 3912 | |
| 3913 | void BattleUnit::launch(GameState &state, Vec3<float> targetPosition, BodyState bodyState) |
| 3914 | { |
| 3915 | Vec3<float> targetVectorXY; |
| 3916 | float velocityXY; |
| 3917 | float velocityZ; |
| 3918 | if (!canLaunch(targetPosition, targetVectorXY, velocityXY, velocityZ)) |
| 3919 | { |
| 3920 | return; |
| 3921 | } |
| 3922 | startFalling(state); |
| 3923 | launchGoal = targetPosition; |
| 3924 | launched = true; |
| 3925 | velocity = (glm::normalize(targetVectorXY) * velocityXY + Vec3<float>{0.0f, 0.0f, velocityZ}) * |
| 3926 | VELOCITY_SCALE_BATTLE; |
| 3927 | collisionIgnoredTicks = (int)ceilf(36.0f / glm::length(velocity / VELOCITY_SCALE_BATTLE)) + 1; |
| 3928 | beginBodyStateChange(state, bodyState); |
| 3929 | } |
| 3930 | |
| 3931 | void BattleUnit::startMoving(GameState &state) |
| 3932 | { |