mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 12:01:50 +00:00
add triggers
This commit is contained in:
parent
50c714692a
commit
5769be8ec8
15 changed files with 239 additions and 64 deletions
|
|
@ -1,17 +1,21 @@
|
|||
#ifndef PHYSICS_PHYSICSSOLVER_HPP_
|
||||
#define PHYSICS_PHYSICSSOLVER_HPP_
|
||||
|
||||
#include "Hitbox.hpp"
|
||||
|
||||
#include "../typedefs.hpp"
|
||||
#include "../voxels/voxel.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
class Block;
|
||||
class Chunks;
|
||||
struct Hitbox;
|
||||
struct Trigger;
|
||||
|
||||
class PhysicsSolver {
|
||||
glm::vec3 gravity;
|
||||
std::vector<Trigger*> triggers;
|
||||
public:
|
||||
PhysicsSolver(glm::vec3 gravity);
|
||||
void step(
|
||||
|
|
@ -21,18 +25,23 @@ public:
|
|||
uint substeps,
|
||||
bool shifting,
|
||||
float gravityScale,
|
||||
bool collisions
|
||||
bool collisions,
|
||||
entityid_t entity
|
||||
);
|
||||
void colisionCalc(
|
||||
Chunks* chunks,
|
||||
Hitbox* hitbox,
|
||||
glm::vec3& vel,
|
||||
glm::vec3& pos,
|
||||
Chunks* chunks,
|
||||
Hitbox* hitbox,
|
||||
glm::vec3& vel,
|
||||
glm::vec3& pos,
|
||||
const glm::vec3 half,
|
||||
float stepHeight
|
||||
);
|
||||
bool isBlockInside(int x, int y, int z, Hitbox* hitbox);
|
||||
bool isBlockInside(int x, int y, int z, Block* def, blockstate state, Hitbox* hitbox);
|
||||
|
||||
void setTriggers(std::vector<Trigger*> triggers) {
|
||||
this->triggers = std::move(triggers);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // PHYSICS_PHYSICSSOLVER_HPP_
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue