add 'on_physics_update' entity event
This commit is contained in:
@@ -25,7 +25,10 @@
|
||||
static debug::Logger logger("entities");
|
||||
|
||||
Entities::Entities(Level& level)
|
||||
: level(level), sensorsTickClock(20, 3), updateTickClock(20, 3) {
|
||||
: level(level),
|
||||
sensorsTickClock(20, 3),
|
||||
updateTickClock(20, 3),
|
||||
physicsTickClock(60, 1) {
|
||||
}
|
||||
|
||||
std::optional<Entity> Entities::get(entityid_t id) {
|
||||
@@ -320,6 +323,13 @@ void Entities::update(float delta) {
|
||||
updateTickClock.getPart()
|
||||
);
|
||||
}
|
||||
if (physicsTickClock.update(delta)) {
|
||||
scripting::on_entities_physics_update(
|
||||
physicsTickClock.getTickRate(),
|
||||
physicsTickClock.getParts(),
|
||||
physicsTickClock.getPart()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static void debug_render_skeleton(
|
||||
|
||||
@@ -39,6 +39,7 @@ class Entities {
|
||||
entityid_t nextID = 1;
|
||||
util::Clock sensorsTickClock;
|
||||
util::Clock updateTickClock;
|
||||
util::Clock physicsTickClock;
|
||||
|
||||
void updateSensors(
|
||||
Rigidbody& body, const Transform& tsf, std::vector<Sensor*>& sensors
|
||||
|
||||
Reference in New Issue
Block a user