Josh Posted September 24, 2019 Posted September 24, 2019 This is for Turbo Engine but can be adapted for Leadwerks. Resizes model without changing scale. void Resize(shared_ptr<Entity> entity, const float scale) { entity->SetPosition(entity->GetPosition() * scale); auto model = dynamic_pointer_cast<Model>(entity); if (model) { for (auto mesh : model->lods[0]->meshes) { for (int v = 0; v < mesh->vertices.size(); ++v) { mesh->vertices[v].position *= scale; } mesh->Finalize(); mesh->UpdateBounds(); } model->UpdateBounds(1 + 2 + 4); } for (auto child : entity->kids) { Resize(child, scale); } } 3 Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.