New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Fixes spawn position of preselected trucks #1046

merged 1 commit into from Jun 9, 2016
Jump to file or symbol
Failed to load files and symbols.
+19 −8
Diff settings


Just for now

Copy path View file
@@ -669,18 +669,29 @@ bool MainThread::SetupGameplayLoop(Ogre::String preselected_map)
const std::vector<Ogre::String> truckConfig = std::vector<Ogre::String>(1, preselected_truck_config);
bool enterTruck = (BSETTING("Enter Preselected Truck", false));
Vector3 pos = gEnv->terrainManager->getSpawnPos();
Quaternion rot = Quaternion::ZERO;
Vector3 pos = gEnv->player->getPosition();
Quaternion rot = Quaternion(Degree(180) - gEnv->player->getRotation(), Vector3::UNIT_Y);
Beam* b = BeamFactory::getSingleton().CreateLocalRigInstance(pos, rot, preselected_truck, -1, nullptr, false, &truckConfig);
if (enterTruck && b && b->free_node > 0)
if (b != nullptr)
if (b && b->engine)
// Calculate translational offset for node[0] to align the trucks rotation center with m_reload_pos
Vector3 translation = pos - b->getRotationCenter();
b->resetPosition(b->nodes[0].AbsPosition + Vector3(translation.x, 0.0f, translation.z), true);
if (enterTruck && b->free_node > 0)
if (b->engine)
ProTip! Use n and p to navigate between commits in a pull request.