diff --git a/source/main/gfx/GfxActor.cpp b/source/main/gfx/GfxActor.cpp index 20ba62ba67..ac3d09ce9f 100644 --- a/source/main/gfx/GfxActor.cpp +++ b/source/main/gfx/GfxActor.cpp @@ -1815,7 +1815,8 @@ void RoR::GfxActor::UpdateCabMesh() { if ((m_cab_entity != nullptr) && (m_cab_mesh != nullptr)) { - m_cab_scene_node->setPosition(m_cab_mesh->UpdateFlexObj()); + m_cab_scene_node->setPosition(m_simbuf.simbuf_origin); + m_cab_mesh->UpdateFlexObj(); } } diff --git a/source/main/physics/flex/FlexObj.cpp b/source/main/physics/flex/FlexObj.cpp index e006ab631c..12624c1560 100644 --- a/source/main/physics/flex/FlexObj.cpp +++ b/source/main/physics/flex/FlexObj.cpp @@ -183,14 +183,13 @@ int FlexObj::ComputeVertexPos(int tidx, int v, std::vector& submeshe return 0; } -Vector3 FlexObj::UpdateMesh() +void FlexObj::UpdateMesh() { RoR::NodeSB* all_nodes = m_gfx_actor->GetSimNodeBuffer(); - Ogre::Vector3 center=(all_nodes[m_vertex_nodes[0]].AbsPosition+all_nodes[m_vertex_nodes[1]].AbsPosition)/2.0; for (size_t i=0; iUpdateMesh(); + this->UpdateMesh(); m_hw_vbuf->writeData(0, m_hw_vbuf->getSizeInBytes(), m_vertices_raw, true); - return center; } FlexObj::~FlexObj() diff --git a/source/main/physics/flex/FlexObj.h b/source/main/physics/flex/FlexObj.h index 3aec214c56..7f1e4cca74 100644 --- a/source/main/physics/flex/FlexObj.h +++ b/source/main/physics/flex/FlexObj.h @@ -74,7 +74,7 @@ class FlexObj ~FlexObj(); - Ogre::Vector3 UpdateFlexObj(); + void UpdateFlexObj(); void ScaleFlexObj(float factor); private: @@ -88,7 +88,7 @@ class FlexObj /// Compute vertex position in the vertexbuffer (0-based offset) for node `v` of triangle `tidx` int ComputeVertexPos(int tidx, int v, std::vector& submeshes); - Ogre::Vector3 UpdateMesh(); + void UpdateMesh(); Ogre::MeshPtr m_mesh; std::vector m_submeshes;