summaryrefslogtreecommitdiffstats
path: root/servers/physics_2d/collision_object_2d_sw.h
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-02-19 11:57:14 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-02-19 11:57:14 -0300
commitd7d65fa2f2b51d03f7bdfcbceedca99188ce979c (patch)
treefecdf1bfa39ba5a4895b4dbf340a3b68098c109a /servers/physics_2d/collision_object_2d_sw.h
parent8c1731b67995add31361ae526b0e6af76346181e (diff)
downloadredot-engine-d7d65fa2f2b51d03f7bdfcbceedca99188ce979c.tar.gz
-improved physics ccd
-html5 exporter works again -disable repeat on image loader by default -can change shape offset en tileset, texture offset was broken
Diffstat (limited to 'servers/physics_2d/collision_object_2d_sw.h')
-rw-r--r--servers/physics_2d/collision_object_2d_sw.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/servers/physics_2d/collision_object_2d_sw.h b/servers/physics_2d/collision_object_2d_sw.h
index b2d2c25451..74457cfa0a 100644
--- a/servers/physics_2d/collision_object_2d_sw.h
+++ b/servers/physics_2d/collision_object_2d_sw.h
@@ -55,8 +55,10 @@ private:
BroadPhase2DSW::ID bpid;
Rect2 aabb_cache; //for rayqueries
Shape2DSW *shape;
+ Vector2 kinematic_advance;
+ float kinematic_retreat;
bool trigger;
- Shape() { trigger=false; }
+ Shape() { trigger=false; kinematic_retreat=0; }
};
Vector<Shape> shapes;
@@ -73,7 +75,7 @@ protected:
void _update_shapes_with_motion(const Vector2& p_motion);
void _unregister_shapes();
- _FORCE_INLINE_ void _set_transform(const Matrix32& p_transform) { transform=p_transform; _update_shapes(); }
+ _FORCE_INLINE_ void _set_transform(const Matrix32& p_transform, bool p_update_shapes=true) { transform=p_transform; if (p_update_shapes) {_update_shapes();} }
_FORCE_INLINE_ void _set_inv_transform(const Matrix32& p_transform) { inv_transform=p_transform; }
void _set_static(bool p_static);
@@ -101,6 +103,12 @@ public:
_FORCE_INLINE_ const Matrix32& get_shape_inv_transform(int p_index) const { return shapes[p_index].xform_inv; }
_FORCE_INLINE_ const Rect2& get_shape_aabb(int p_index) const { return shapes[p_index].aabb_cache; }
+ _FORCE_INLINE_ void set_shape_kinematic_advance(int p_index,const Vector2& p_advance) { shapes[p_index].kinematic_advance=p_advance; }
+ _FORCE_INLINE_ Vector2 get_shape_kinematic_advance(int p_index) const { return shapes[p_index].kinematic_advance; }
+
+ _FORCE_INLINE_ void set_shape_kinematic_retreat(int p_index,float p_retreat) { shapes[p_index].kinematic_retreat=p_retreat; }
+ _FORCE_INLINE_ float get_shape_kinematic_retreat(int p_index) const { return shapes[p_index].kinematic_retreat; }
+
_FORCE_INLINE_ Matrix32 get_transform() const { return transform; }
_FORCE_INLINE_ Matrix32 get_inv_transform() const { return inv_transform; }
_FORCE_INLINE_ Space2DSW* get_space() const { return space; }
@@ -109,6 +117,7 @@ public:
_FORCE_INLINE_ bool is_shape_set_as_trigger(int p_idx) const { return shapes[p_idx].trigger; }
+
void remove_shape(Shape2DSW *p_shape);
void remove_shape(int p_index);