Physics stuff

This commit is contained in:
Confideo-IOM
2026-08-25 22:10:54 +01:00
parent 1253571c17
commit 30538ae7ab
59 changed files with 1403 additions and 518 deletions
@@ -0,0 +1,31 @@
#ifndef HYDRASETPHYSICSLINEARVELOCITY
#define HYDRASETPHYSICSLINEARVELOCITY
#include "../HydraTask.h"
#include "../../engine/HydraEngine.h"
#include "../../renderer/HydraRenderer.h"
#include <GLMIncludes.h>
#include "../../GlewIncludes.h"
#include "../../buffer/HydraTextureBufferManager.h"
#include <box3d/box3d.h>
class HydraSetPhysicsLinearVelocity : public HydraTask
{
private:
b3BodyId m_body_id = {};
glm::vec3 m_velocity = {};
protected:
public:
void Process() override
{
b3Vec3 velocity = {m_velocity.x, m_velocity.y, m_velocity.z};
b3Body_SetLinearVelocity(m_body_id, velocity);
}
void Initialise(b3BodyId body_id, glm::vec3 velocity)
{
m_body_id = body_id;
m_velocity = velocity;
}
};
#endif /* HYDRASETPHYSICSLINEARVELOCITY */
@@ -25,7 +25,7 @@ public:
b3Quat rotation = {m_rotation.x, m_rotation.y, m_rotation.z, m_rotation.w};
b3Body_SetTransform(m_body_id, position, rotation);
}
void Initialise(b3BodyId body_id, glm::vec3 position, glm::quat rotation)
{
@@ -22,6 +22,7 @@ public:
b3World_Step(m_world_id, m_delta_t_seconds, 1);
b3BodyEvents events = b3World_GetBodyEvents(m_world_id);
HydraTaskScheduler* task_scheduler = GetEngine()->TaskScheduler();
HydraID barrier_id = task_scheduler->CreateBarrier();