first commit
This commit is contained in:
48
src/game/ecs/component/physics/component_physics.h
Normal file
48
src/game/ecs/component/physics/component_physics.h
Normal file
@ -0,0 +1,48 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ecs_entity.h"
|
||||
|
||||
#include "../../../input/control.h"
|
||||
|
||||
static const f32 COMPONENT_PHYSICS_FRICTION_DEFAULT = 1.0f;
|
||||
static const vec3 COMPONENT_PHYSICS_VELOCITY_MAX_DEFAULT = {1000.0f, 1000.0f, 1000.0f};
|
||||
|
||||
typedef struct ComponentPhysics
|
||||
{
|
||||
Component component;
|
||||
vec3 position;
|
||||
vec3 velocity;
|
||||
vec3 velocityMax;
|
||||
f32 friction;
|
||||
bool isMoving;
|
||||
} ComponentPhysics;
|
||||
|
||||
void component_physics_tick(ComponentPhysics* self, ECS* ecs);
|
||||
void component_physics_next_position_get(ComponentPhysics* self, ECS* ecs, vec2 position);
|
||||
f32 component_physics_next_position_distance_get(ComponentPhysics* self, ECS* ecs);
|
||||
|
||||
void component_physics_init
|
||||
(
|
||||
ComponentPhysics* self,
|
||||
ECS* ecs,
|
||||
const vec3 position,
|
||||
const vec3 velocityMax,
|
||||
f32 friction
|
||||
);
|
||||
|
||||
static const ComponentInfo COMPONENT_PHYSICS_INFO =
|
||||
{
|
||||
.system =
|
||||
{
|
||||
.functions =
|
||||
{
|
||||
NULL,
|
||||
NULL,
|
||||
(ECSFunction)component_physics_tick,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
},
|
||||
.type = COMPONENT_PHYSICS,
|
||||
.size = sizeof(ComponentPhysics)
|
||||
};
|
Reference in New Issue
Block a user