Added Capsule Collider to C# #409
|
@ -454,7 +454,8 @@ namespace SHADE
|
|||
{
|
||||
if(auto entityTransform = SHComponentManager::GetComponent_s<SHTransformComponent>(eid))
|
||||
{
|
||||
editorCam->SetPosition(entityTransform->GetWorldPosition() + SHVec3(0.5f));
|
||||
SHVec3 scale = entityTransform->GetLocalScale();
|
||||
editorCam->SetPosition(entityTransform->GetWorldPosition() + scale * 0.5f);
|
||||
camSystem->CameraLookAt(*editorCam, entityTransform->GetWorldPosition());
|
||||
camSystem->UpdateEditorCamera(SHFrameRateController::GetRawDeltaTime());
|
||||
}
|
||||
|
|
|
@ -273,8 +273,8 @@ namespace SHADE
|
|||
}
|
||||
if (rbType == SHRigidBodyComponent::Type::DYNAMIC || rbType == SHRigidBodyComponent::Type::KINEMATIC) //Dynamic or Kinematic only fields
|
||||
{
|
||||
SHEditorWidgets::DragFloat("Drag", [component] {return component->GetDrag(); }, [component](float const& value) {component->SetDrag(value); }, "Drag");
|
||||
SHEditorWidgets::DragFloat("Angular Drag", [component] {return component->GetAngularDrag(); }, [component](float const& value) {component->SetAngularDrag(value); }, "Angular Drag");
|
||||
SHEditorWidgets::DragFloat("Drag", [component] {return component->GetDrag(); }, [component](float const& value) {component->SetDrag(value); }, "Drag", 0.1f, 0.0001f, std::numeric_limits<float>::infinity());
|
||||
SHEditorWidgets::DragFloat("Angular Drag", [component] {return component->GetAngularDrag(); }, [component](float const& value) {component->SetAngularDrag(value); }, "Angular Drag", 0.1f, 0.0001f, std::numeric_limits<float>::infinity());
|
||||
|
||||
SHEditorWidgets::CheckBox("Interpolate", [component] {return component->IsInterpolating(); }, [component](bool const& value) {component->SetInterpolate(value); }, "Interpolate");
|
||||
|
||||
|
@ -377,7 +377,8 @@ namespace SHADE
|
|||
(
|
||||
"Radius",
|
||||
[sphereShape] { return sphereShape->GetRelativeRadius(); },
|
||||
[sphereShape](float const& value) { sphereShape->SetRelativeRadius(value); }
|
||||
[sphereShape](float const& value) { sphereShape->SetRelativeRadius(value); }, "Collider Radius", 0.1f,
|
||||
0.0001f, std::numeric_limits<float>::infinity()
|
||||
);
|
||||
}
|
||||
else if (collisionShape->GetType() == SHCollisionShape::Type::CAPSULE)
|
||||
|
@ -388,13 +389,15 @@ namespace SHADE
|
|||
(
|
||||
"Radius",
|
||||
[capsuleShape] { return capsuleShape->GetRelativeRadius(); },
|
||||
[capsuleShape](float const& value) { capsuleShape->SetRelativeRadius(value); }
|
||||
[capsuleShape](float const& value) { capsuleShape->SetRelativeRadius(value); }, "Collider Radius", 0.1f,
|
||||
0.0001f, std::numeric_limits<float>::infinity()
|
||||
);
|
||||
SHEditorWidgets::DragFloat
|
||||
(
|
||||
"Height",
|
||||
[capsuleShape] { return capsuleShape->GetRelativeHeight(); },
|
||||
[capsuleShape](float const& value) { capsuleShape->SetRelativeHeight(value); }
|
||||
[capsuleShape](float const& value) { capsuleShape->SetRelativeHeight(value); }, "Collider Height", 0.1f,
|
||||
0.0001f, std::numeric_limits<float>::infinity()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include "SHEditorComponentView.h"
|
||||
#include "AudioSystem/SHAudioListenerComponent.h"
|
||||
#include "Graphics/MiddleEnd/TextRendering/SHTextRenderableComponent.h"
|
||||
#include "Camera/SHCameraSystem.h"
|
||||
#include "FRC/SHFramerateController.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -106,6 +108,7 @@ namespace SHADE
|
|||
{
|
||||
if (editor && !editor->selectedEntities.empty())
|
||||
{
|
||||
DrawMenuBar();
|
||||
EntityID const& eid = editor->selectedEntities[0];
|
||||
SHEntity* entity = SHEntityManager::GetEntityByID(eid);
|
||||
SHSceneNode* entityNode = SHSceneManager::GetCurrentSceneGraph().GetNode(eid);
|
||||
|
@ -114,6 +117,7 @@ namespace SHADE
|
|||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui::TextColored(ImGuiColors::green, "EID: %zu", eid);
|
||||
SHEditorWidgets::CheckBox("##IsActive", [entityNode]()->bool {return entityNode->IsActive(); }, [entityNode](bool const& active) {entityNode->SetActive(active); });
|
||||
ImGui::SameLine();
|
||||
|
@ -222,4 +226,36 @@ namespace SHADE
|
|||
{
|
||||
SHEditorWindow::Exit();
|
||||
}
|
||||
void SHEditorInspector::DrawMenuBar()
|
||||
{
|
||||
if(ImGui::BeginMenuBar())
|
||||
{
|
||||
EntityID const& eid = editor->selectedEntities[0];
|
||||
SHEntity* entity = SHEntityManager::GetEntityByID(eid);
|
||||
SHSceneNode* entityNode = SHSceneManager::GetCurrentSceneGraph().GetNode(eid);
|
||||
if (!entity || !entityNode)
|
||||
{
|
||||
ImGui::EndMenuBar();
|
||||
return;
|
||||
}
|
||||
if (ImGui::SmallButton("Look At"))
|
||||
{
|
||||
editor->selectedEntities.clear();
|
||||
editor->selectedEntities.push_back(eid);
|
||||
if (auto camSystem = SHSystemManager::GetSystem<SHCameraSystem>())
|
||||
{
|
||||
if (auto editorCam = camSystem->GetEditorCamera())
|
||||
{
|
||||
if (auto entityTransform = SHComponentManager::GetComponent_s<SHTransformComponent>(eid))
|
||||
{
|
||||
editorCam->SetPosition(entityTransform->GetWorldPosition() + SHVec3(0.5f));
|
||||
camSystem->CameraLookAt(*editorCam, entityTransform->GetWorldPosition());
|
||||
camSystem->UpdateEditorCamera(SHFrameRateController::GetRawDeltaTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,6 @@ namespace SHADE
|
|||
void Exit() override;
|
||||
|
||||
private:
|
||||
|
||||
void DrawMenuBar();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -358,6 +358,7 @@ namespace SHADE
|
|||
|
||||
void SHEditorMenuBar::DrawPhysicsSettings() noexcept
|
||||
{
|
||||
ImGui::SetNextWindowSize({400.0f, 0.0f});
|
||||
if (ImGui::BeginMenu("Physics Settings"))
|
||||
{
|
||||
if (auto* physicsSystem = SHSystemManager::GetSystem<SHPhysicsSystem>())
|
||||
|
|
|
@ -669,6 +669,12 @@ namespace SHADE
|
|||
SaveScene();
|
||||
}
|
||||
}
|
||||
if(editorState == State::PLAY && ImGui::IsKeyReleased(ImGuiKey_LeftAlt))
|
||||
{
|
||||
SHInputManager::SetMouseCentering(!SHInputManager::GetMouseCentering());
|
||||
SHWindow::SetMouseVisible(!SHWindow::GetMouseVisible());
|
||||
|
||||
}
|
||||
if (ImGui::IsKeyDown(ImGuiKey_LeftShift) && ImGui::IsKeyDown(ImGuiKey_LeftCtrl) && ImGui::IsKeyReleased(ImGuiKey_Z))
|
||||
{
|
||||
SHCommandManager::RedoCommand();
|
||||
|
|
Loading…
Reference in New Issue