Physics working
This commit is contained in:
@@ -6,7 +6,9 @@
|
||||
#include "../ecs/HydraEntityManager.h"
|
||||
#include "../ecs/HydraECS.h"
|
||||
#include "../ecs/components/HydraPositionComponent.h"
|
||||
#include "../ecs/components/HydraPhysicsComponent.h"
|
||||
#include "../ecs/systems/HydraTransformSystem.h"
|
||||
#include "../ecs/systems/HydraPhysicsSystem.h"
|
||||
#include "../fileaccess/HydraGLTFLoader.h"
|
||||
#include "../task/actor/HydraLoadGLTFFileTask.hpp"
|
||||
#include "../scheduler/HydraTaskScheduler.h"
|
||||
@@ -167,18 +169,11 @@ void HydraActorManager::SetPosition(HydraID actorID, glm::dvec3 position)
|
||||
|
||||
HydraPositionComponent &pos_comp = ecs->GetComponent<HydraPositionComponent>(actorID);
|
||||
pos_comp.position = position;
|
||||
|
||||
|
||||
// if (ecs->HasComponent<HydraECSPhysicsComponent>(actorID))
|
||||
// {
|
||||
// HydraECSPhysicsComponent &phys_comp = ecs->GetComponent<HydraECSPhysicsComponent>(actorID);
|
||||
// // const float* matrix = glm::value_ptr<float>(GetActorPose(actorID));
|
||||
|
||||
// phys_comp.physics_definition.pose = GetActorPose(actorID);
|
||||
// }
|
||||
if(!pos_comp.needs_update)
|
||||
|
||||
if(!pos_comp.needs_update)
|
||||
{
|
||||
ecs->GetSystem<HydraTransformSystem>()->UpdateTransform(actorID);
|
||||
ecs->GetSystem<HydraTransformSystem>()->UpdateTransform(actorID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,16 +184,24 @@ void HydraActorManager::SetOrientation(HydraID actorID, float x, float y, float
|
||||
pos_comp.orientation = glm::vec3(x, y, z);
|
||||
if(!pos_comp.needs_update)
|
||||
{
|
||||
|
||||
// if (ecs->HasComponent<HydraECSPhysicsComponent>(actorID))
|
||||
// {
|
||||
// HydraECSPhysicsComponent &phys_comp = ecs->GetComponent<HydraECSPhysicsComponent>(actorID);
|
||||
// phys_comp.physics_definition.pose = GetActorPose(actorID);
|
||||
// }
|
||||
ecs->GetSystem<HydraTransformSystem>()->UpdateTransform(actorID);
|
||||
}
|
||||
}
|
||||
|
||||
void HydraActorManager::SetPositionAndOrientation(HydraID actorID, glm::dvec3 position, glm::vec3 euler_angles, bool ignore_physics)
|
||||
{
|
||||
HydraECS *ecs = GetEngine()->ECS();
|
||||
|
||||
HydraPositionComponent &pos_comp = ecs->GetComponent<HydraPositionComponent>(actorID);
|
||||
pos_comp.position = position;
|
||||
pos_comp.orientation = glm::vec3(euler_angles.x,euler_angles.y,euler_angles.z);
|
||||
|
||||
if(!pos_comp.needs_update)
|
||||
{
|
||||
ecs->GetSystem<HydraTransformSystem>()->UpdateTransform(actorID, ignore_physics);
|
||||
}
|
||||
}
|
||||
|
||||
void HydraActorManager::SetScale(HydraID actor_id, glm::dvec3 scaling)
|
||||
{
|
||||
HydraECS *ecs = GetEngine()->ECS();
|
||||
|
||||
Reference in New Issue
Block a user