added support for ragdoll scaling

This commit is contained in:
Turánszki János
2023-10-31 18:17:43 +01:00
parent adab77de55
commit c1d5ba7b32
5 changed files with 48 additions and 16 deletions
+9 -4
View File
@@ -56,7 +56,7 @@ void HumanoidWindow::Create(EditorComponent* _editor)
lookatMouseCheckBox.SetCheck(true);
ragdollCheckBox.Create("Ragdoll: ");
ragdollCheckBox.SetTooltip("Activate dynamic ragdoll physics. Note that kinematic ragdoll physics is always active (ragdoll is animation-driven/kinematic by default).");
ragdollCheckBox.SetTooltip("Activate dynamic ragdoll physics.\nNote that kinematic ragdoll physics is always active (ragdoll is animation-driven/kinematic by default).\nNote that scaling humanoid will disable ragdoll physics and you need to re-enable if you want to.");
ragdollCheckBox.SetSize(XMFLOAT2(hei, hei));
ragdollCheckBox.OnClick([=](wi::gui::EventArgs args) {
wi::scene::Scene& scene = editor->GetCurrentScene();
@@ -214,13 +214,18 @@ void HumanoidWindow::Create(EditorComponent* _editor)
void HumanoidWindow::SetEntity(Entity entity)
{
if (this->entity == entity)
return;
Scene& scene = editor->GetCurrentScene();
const HumanoidComponent* humanoid = scene.humanoids.GetComponent(entity);
if (humanoid != nullptr)
{
ragdollCheckBox.SetCheck(humanoid->IsRagdollPhysicsEnabled()); // this is always force updated
}
if (this->entity == entity)
return;
if (humanoid != nullptr || IsCollapsed())
{
this->entity = entity;