world::Planet &GetPlanet() const noexcept { return *planet; }
bool OnSurface() const noexcept;
const glm::dvec3 &Position() const noexcept { return state.pos; }
+ glm::dvec3 SurfaceNormal() const noexcept;
world::Tile &GetTile() const noexcept;
const world::TileType &GetTileType() const noexcept;
// TODO: duplicate situation somehow
a->GetSituation().SetPlanetSurface(
s.GetPlanet(),
- s.Position() + glm::dvec3(0.0, 0.55 * a->Size(), 0.0));
+ s.Position() + glm::rotate(s.Heading() * a->Size() * 0.6, PI * 0.5, s.SurfaceNormal()));
a->BuildVAO();
c.GetSimulation().Log() << a->Name() << " was born" << std::endl;
s.GetPlanet().AddCreature(b);
b->GetSituation().SetPlanetSurface(
s.GetPlanet(),
- s.Position() - glm::dvec3(0.0, 0.55 * b->Size(), 0.0));
+ s.Position() + glm::rotate(s.Heading() * b->Size() * 0.6, PI * -0.5, s.SurfaceNormal()));
b->BuildVAO();
c.GetSimulation().Log() << b->Name() << " was born" << std::endl;
return type == PLANET_SURFACE;
}
+glm::dvec3 Situation::SurfaceNormal() const noexcept {
+ return planet->NormalAt(state.pos);
+}
+
world::Tile &Situation::GetTile() const noexcept {
return planet->TileAt(state.pos);
}