aboutsummaryrefslogtreecommitdiff
path: root/servers/physics_2d_server.h
diff options
context:
space:
mode:
authorJuan Linietsky2014-02-22 20:28:19 -0300
committerJuan Linietsky2014-02-22 20:28:19 -0300
commit7ca29bfaa7a23d06374c2456e0360c911bd9aa3e (patch)
treedc615e0c7a55dff92af81be0ff2555e1f9485eba /servers/physics_2d_server.h
parentb62ec387f340220e11902daab8484fcb85d28cda (diff)
downloadgodot-7ca29bfaa7a23d06374c2456e0360c911bd9aa3e.tar.gz
godot-7ca29bfaa7a23d06374c2456e0360c911bd9aa3e.tar.zst
godot-7ca29bfaa7a23d06374c2456e0360c911bd9aa3e.zip
Diffstat (limited to 'servers/physics_2d_server.h')
-rw-r--r--servers/physics_2d_server.h31
1 files changed, 21 insertions, 10 deletions
diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h
index 5242ec0e2..172fa1699 100644
--- a/servers/physics_2d_server.h
+++ b/servers/physics_2d_server.h
@@ -98,6 +98,16 @@ protected:
public:
+ enum ObjectTypeMask {
+ TYPE_MASK_STATIC_BODY=1<<0,
+ TYPE_MASK_KINEMATIC_BODY=1<<1,
+ TYPE_MASK_RIGID_BODY=1<<2,
+ TYPE_MASK_CHARACTER_BODY=1<<3,
+ TYPE_MASK_AREA=1<<4,
+ TYPE_MASK_COLLISION=TYPE_MASK_STATIC_BODY|TYPE_MASK_CHARACTER_BODY|TYPE_MASK_KINEMATIC_BODY|TYPE_MASK_RIGID_BODY
+
+ };
+
struct RayResult {
Vector2 position;
@@ -108,7 +118,7 @@ public:
int shape;
};
- virtual bool intersect_ray(const Vector2& p_from, const Vector2& p_to,RayResult &r_result,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_user_mask=0)=0;
+ virtual bool intersect_ray(const Vector2& p_from, const Vector2& p_to,RayResult &r_result,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_user_mask=0,uint32_t p_object_type_mask=TYPE_MASK_COLLISION)=0;
struct ShapeResult {
@@ -119,25 +129,26 @@ public:
};
- virtual int intersect_shape(const RID& p_shape, const Matrix32& p_xform,const Vector2& p_motion,ShapeResult *r_results,int p_result_max,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_user_mask=0)=0;
+ virtual int intersect_shape(const RID& p_shape, const Matrix32& p_xform,const Vector2& p_motion,float p_margin,ShapeResult *r_results,int p_result_max,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_user_mask=0,uint32_t p_object_type_mask=TYPE_MASK_COLLISION)=0;
+
+ virtual bool cast_motion(const RID& p_shape, const Matrix32& p_xform,const Vector2& p_motion,float p_margin,float &p_closest_safe,float &p_closest_unsafe, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_user_mask=0,uint32_t p_object_type_mask=TYPE_MASK_COLLISION)=0;
- struct MotionCastCollision {
+ virtual bool collide_shape(RID p_shape, const Matrix32& p_shape_xform,const Vector2& p_motion,float p_margin,Vector2 *r_results,int p_result_max,int &r_result_count, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_user_mask=0,uint32_t p_object_type_mask=TYPE_MASK_COLLISION)=0;
+
+ struct ShapeRestInfo {
- float travel; //0 to 1, if 0 then it's blocked
Vector2 point;
Vector2 normal;
RID rid;
ObjectID collider_id;
- Object *collider;
int shape;
+ Vector2 linear_velocity; //velocity at contact point
};
- virtual bool cast_motion(const RID& p_shape, const Matrix32& p_xform,const Vector2& p_motion, MotionCastCollision &r_result, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_user_mask=0)=0;
-
-
+ virtual bool rest_info(RID p_shape, const Matrix32& p_shape_xform,const Vector2& p_motion,float p_margin,ShapeRestInfo *r_info, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_user_mask=0,uint32_t p_object_type_mask=TYPE_MASK_COLLISION)=0;
Physics2DDirectSpaceState();
@@ -327,8 +338,8 @@ public:
virtual void body_set_continuous_collision_detection_mode(RID p_body,CCDMode p_mode)=0;
virtual CCDMode body_get_continuous_collision_detection_mode(RID p_body) const=0;
- virtual void body_set_user_flags(RID p_body, uint32_t p_flags)=0;
- virtual uint32_t body_get_user_flags(RID p_body, uint32_t p_flags) const=0;
+ virtual void body_set_user_mask(RID p_body, uint32_t p_mask)=0;
+ virtual uint32_t body_get_user_mask(RID p_body, uint32_t p_mask) const=0;
// common body variables
enum BodyParameter {