return type == PLANET_SURFACE;
}
+bool Situation::OnGround() const noexcept {
+ return OnSurface() && glm::length2(state.pos) < (planet->Radius() + 0.05) * (planet->Radius() + 0.05);
+}
+
glm::dvec3 Situation::SurfaceNormal() const noexcept {
return planet->NormalAt(state.pos);
}
result += TargetVelocity(s, diff * std::min(dist * force, speed) / dist, force);
}
}
+ // remove vertical component, if any
+ const glm::dvec3 normal(c.GetSituation().GetPlanet().NormalAt(s.pos));
+ result += normal * glm::dot(normal, result);
+ // clamp to max
if (glm::length2(result) > max_force * max_force) {
result = glm::normalize(result) * max_force;
}