MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / launch

Method launch

game/state/battle/battleunit.cpp:3913–3929  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3911}
3912
3913void 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
3931void BattleUnit::startMoving(GameState &state)
3932{

Callers 1

updateMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected