summaryrefslogtreecommitdiffstats
path: root/modules/bullet/space_bullet.h
diff options
context:
space:
mode:
authorAndrea Catania <info@andreacatania.com>2020-07-10 09:21:12 +0200
committerAndrea Catania <info@andreacatania.com>2020-07-27 08:25:47 +0200
commit8d0d6d6921d5dfb398f4ab04e4d3937ab550c4ff (patch)
treee08bf777d921a71ad72fc661c2772fed0edd34a1 /modules/bullet/space_bullet.h
parent9e34ba48556b71f1f672b5be47d12b0e3f679b86 (diff)
downloadredot-engine-8d0d6d6921d5dfb398f4ab04e4d3937ab550c4ff.tar.gz
- Enhanced the flush mechanism by flushing only needed thing.
- Flushing Areas before anything else. - Make sure to correctly fetch gravity when the integrate_forces function is used - Lazy reload body when layer and mask changes - Shapes are reloaded just before the physics step starts. - Improved some other parts of the code. - Added override keyword - Using LocalVector
Diffstat (limited to 'modules/bullet/space_bullet.h')
-rw-r--r--modules/bullet/space_bullet.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/modules/bullet/space_bullet.h b/modules/bullet/space_bullet.h
index aa9a70594e..897f902fe1 100644
--- a/modules/bullet/space_bullet.h
+++ b/modules/bullet/space_bullet.h
@@ -31,8 +31,8 @@
#ifndef SPACE_BULLET_H
#define SPACE_BULLET_H
+#include "core/local_vector.h"
#include "core/variant.h"
-#include "core/vector.h"
#include "godot_result_callbacks.h"
#include "rid_bullet.h"
#include "servers/physics_server_3d.h"
@@ -110,17 +110,23 @@ class SpaceBullet : public RIDBullet {
real_t linear_damp = 0.0;
real_t angular_damp = 0.0;
- Vector<CollisionObjectBullet *> collision_objects;
- Vector<AreaBullet *> areas;
+ LocalVector<CollisionObjectBullet *> queue_pre_flush;
+ LocalVector<CollisionObjectBullet *> queue_flush;
+ LocalVector<CollisionObjectBullet *> collision_objects;
+ LocalVector<AreaBullet *> areas;
- Vector<Vector3> contactDebug;
- int contactDebugCount = 0;
+ LocalVector<Vector3> contactDebug;
+ uint32_t contactDebugCount = 0;
real_t delta_time = 0.;
public:
SpaceBullet();
virtual ~SpaceBullet();
+ void add_to_flush_queue(CollisionObjectBullet *p_co);
+ void add_to_pre_flush_queue(CollisionObjectBullet *p_co);
+ void remove_from_any_queue(CollisionObjectBullet *p_co);
+
void flush_queries();
real_t get_delta_time() { return delta_time; }
void step(real_t p_delta_time);
@@ -177,7 +183,7 @@ public:
}
_FORCE_INLINE_ void add_debug_contact(const Vector3 &p_contact) {
if (contactDebugCount < contactDebug.size()) {
- contactDebug.write[contactDebugCount++] = p_contact;
+ contactDebug[contactDebugCount++] = p_contact;
}
}
_FORCE_INLINE_ Vector<Vector3> get_debug_contacts() { return contactDebug; }