Raycasts now returns the body instance it collided with + serialize spot light cones

This commit is contained in:
antopilo
2024-10-18 00:21:08 -04:00
parent 4e0817b761
commit 39cf28c91e
6 changed files with 42 additions and 13 deletions

View File

@@ -27,6 +27,7 @@
#include <Coral/Array.hpp>
#include <src/Scene/Components/NavMeshVolumeComponent.h>
#include <src/Scene/Components/RigidbodyComponent.h>
namespace Nuake {
@@ -316,7 +317,7 @@ namespace Nuake {
PhysicsManager::Get().SetCharacterControllerPosition(entity, { x, y, z });
}
if (entity.HasComponent<BSPBrushComponent>())
if (entity.HasComponent<BSPBrushComponent>() || entity.HasComponent<RigidBodyComponent>())
{
PhysicsManager::Get().SetBodyTransform(entity, { x, y, z }, component.GetGlobalRotation());
}
@@ -343,7 +344,7 @@ namespace Nuake {
if (entity.IsValid() && entity.HasComponent<TransformComponent>())
{
auto& component = entity.GetComponent<TransformComponent>();
const auto& globalPosition = component.GetGlobalPosition();
const Vector3& globalPosition = component.GlobalTransform[3];
Coral::Array<float> result = Coral::Array<float>::New({ globalPosition.x, globalPosition.y, globalPosition.z });
return result;
}