diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-09-02 23:13:40 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-09-02 23:13:40 -0300 |
commit | 1a2cb755e2d8b9d59178f36702f6dff7235b9088 (patch) | |
tree | 4a88f47c8b984522e36ac973accb34bdcb00363b /servers/physics_2d_server.h | |
parent | 89fa70706f9166765c3ac3f799225a467800f065 (diff) |
3D Physics and Other Stuff
-=-=-=-=-=-=-=-=-=-=-=-=-=
-New Vehicle (Based on Bullet's RaycastVehicle) - Vehiclebody/VehicleWheel. Demo will come soon, old vehicle (CarBody) will go away soon too.
-A lot of fixes to the 3D physics engine
-Added KinematicBody with demo
-Fixed the space query API for 2D (demo will come soon). 3D is WIP.
-Fixed long-standing bug with body_enter/body_exit for Area and Area2D
-Performance variables now includes physics (active bodies, collision pairs and islands)
-Ability to see what's inside of instanced scenes!
-Fixed Blend Shapes (no bs+skeleton yet)
-Added an Android JavaClassWrapper singleton for using Android native classes directly from GDScript. This is very Alpha!
Diffstat (limited to 'servers/physics_2d_server.h')
-rw-r--r-- | servers/physics_2d_server.h | 65 |
1 files changed, 60 insertions, 5 deletions
diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h index def1e69992..17a21e46a3 100644 --- a/servers/physics_2d_server.h +++ b/servers/physics_2d_server.h @@ -31,6 +31,7 @@ #include "object.h" #include "reference.h" +#include "resource.h" class Physics2DDirectSpaceState; @@ -84,14 +85,60 @@ public: class Physics2DShapeQueryResult; +//used for script +class Physics2DShapeQueryParameters : public Reference { + + OBJ_TYPE(Physics2DShapeQueryParameters, Reference); +friend class Physics2DDirectSpaceState; + RID shape; + Matrix32 transform; + Vector2 motion; + float margin; + Set<RID> exclude; + uint32_t layer_mask; + uint32_t object_type_mask; +protected: + static void _bind_methods(); +public: + + + void set_shape(const RES& p_shape); + void set_shape_rid(const RID& p_shape); + RID get_shape_rid() const; + + void set_transform(const Matrix32& p_transform); + Matrix32 get_transform() const; + + void set_motion(const Vector2& p_motion); + Vector2 get_motion() const; + + void set_margin(float p_margin); + float get_margin() const; + + void set_layer_mask(int p_layer_mask); + int get_layer_mask() const; + + void set_object_type_mask(int p_object_type_mask); + int get_object_type_mask() const; + + void set_exclude(const Vector<RID>& p_exclude); + Vector<RID> get_exclude() const; + + Physics2DShapeQueryParameters(); + +}; + + class Physics2DDirectSpaceState : public Object { OBJ_TYPE( Physics2DDirectSpaceState, Object ); - Variant _intersect_ray(const Vector2& p_from, const Vector2& p_to,const Vector<RID>& p_exclude=Vector<RID>(),uint32_t p_layers=0); - Variant _intersect_shape(const RID& p_shape, const Matrix32& p_xform,int p_result_max=64,const Vector<RID>& p_exclude=Vector<RID>(),uint32_t p_layers=0); - Variant _cast_motion(const RID& p_shape, const Matrix32& p_xform,const Vector2& p_motion,const Vector<RID>& p_exclude=Vector<RID>(),uint32_t p_layers=0); + Dictionary _intersect_ray(const Vector2& p_from, const Vector2& p_to,const Vector<RID>& p_exclude=Vector<RID>(),uint32_t p_layers=0,uint32_t p_object_type_mask=TYPE_MASK_COLLISION); + Array _intersect_shape(const Ref<Physics2DShapeQueryParameters> &p_shape_query,int p_max_results=32); + Array _cast_motion(const Ref<Physics2DShapeQueryParameters> &p_shape_query); + Array _collide_shape(const Ref<Physics2DShapeQueryParameters> &p_shape_query,int p_max_results=32); + Dictionary _get_rest_info(const Ref<Physics2DShapeQueryParameters> &p_shape_query); protected: static void _bind_methods(); @@ -131,8 +178,6 @@ public: 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_layer_mask=0xFFFFFFFF,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_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION)=0; 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_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION)=0; @@ -448,6 +493,15 @@ public: virtual void flush_queries()=0; virtual void finish()=0; + enum ProcessInfo { + + INFO_ACTIVE_OBJECTS, + INFO_COLLISION_PAIRS, + INFO_ISLAND_COUNT + }; + + virtual int get_process_info(ProcessInfo p_info)=0; + Physics2DServer(); ~Physics2DServer(); }; @@ -465,5 +519,6 @@ VARIANT_ENUM_CAST( Physics2DServer::JointType ); VARIANT_ENUM_CAST( Physics2DServer::DampedStringParam ); //VARIANT_ENUM_CAST( Physics2DServer::ObjectType ); VARIANT_ENUM_CAST( Physics2DServer::AreaBodyStatus ); +VARIANT_ENUM_CAST( Physics2DServer::ProcessInfo ); #endif |