1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-22 10:22:52 +01:00

Add vehicle mission spawner to debug menu

This commit is contained in:
Jannik Vogel 2016-06-11 13:21:11 +02:00 committed by Daniel Evans
parent 7394622489
commit 49c05bced9

View File

@ -439,15 +439,15 @@ void DebugState::printCameraDetails()
void DebugState::spawnVehicle(unsigned int id) void DebugState::spawnVehicle(unsigned int id)
{ {
auto ch = game->getPlayer()->getCharacter(); auto ch = game->getPlayer()->getCharacter();
if(! ch) return; if (!ch)
return;
glm::vec3 fwd = ch->rotation * glm::vec3(0.f, 1.f, 0.f); auto playerRot = ch->getRotation();
auto spawnPos = ch->getPosition();
glm::vec3 hit, normal; spawnPos += playerRot * glm::vec3(0.f, 3.f, 0.f);
if(game->hitWorldRay(ch->position + (fwd * 10.f), {0.f, 0.f, -2.f}, hit, normal)) { auto spawnRot = glm::quat(
auto spawnpos = hit + normal; glm::vec3(0.f, 0.f, glm::roll(playerRot) + glm::half_pi<float>()));
getWorld()->createVehicle(id, spawnpos, glm::quat()); getWorld()->createVehicle(id, spawnPos, spawnRot);
}
} }
void DebugState::spawnFollower(unsigned int id) void DebugState::spawnFollower(unsigned int id)