X-Git-Url: http://git.localhorst.tv/?p=blobs.git;a=blobdiff_plain;f=src%2Fcreature%2Fcreature.cpp;h=eebd4f6f51313ba0e6a9fd7ac4155be1513f4914;hp=deb5a10e4173376ca27e3e9434459f570350367f;hb=d05324febdb9f67d66a03a2f716c406289a047e1;hpb=062538c008af86ddb9a9fa2302c1571140e15467 diff --git a/src/creature/creature.cpp b/src/creature/creature.cpp index deb5a10..eebd4f6 100644 --- a/src/creature/creature.cpp +++ b/src/creature/creature.cpp @@ -756,7 +756,7 @@ void Split(Creature &c) { // 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; @@ -770,7 +770,7 @@ void Split(Creature &c) { 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; @@ -891,6 +891,10 @@ bool Situation::OnSurface() const noexcept { 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); }