mirror of
https://github.com/godotengine/godot.git
synced 2026-05-12 22:35:35 +00:00
-improved physics ccd
-html5 exporter works again -disable repeat on image loader by default -can change shape offset en tileset, texture offset was broken
This commit is contained in:
@@ -90,7 +90,7 @@ protected:
|
||||
PhysicsServer * ps = PhysicsServer::get_singleton();
|
||||
|
||||
RID mesh_instance = vs->instance_create2(type_mesh_map[p_shape],scenario);
|
||||
RID body = ps->body_create(p_body,!p_active_default);
|
||||
RID body = ps->body_create(p_body,!p_active_default);
|
||||
ps->body_set_space(body,space);
|
||||
ps->body_set_param(body,PhysicsServer::BODY_PARAM_BOUNCE,0.5);
|
||||
//todo set space
|
||||
|
||||
@@ -270,6 +270,7 @@ protected:
|
||||
RID body = ps->body_create();
|
||||
ps->body_add_shape(body,body_shape_data[p_shape].shape);
|
||||
ps->body_set_space(body,space);
|
||||
ps->body_set_continuous_collision_detection_mode(body,Physics2DServer::CCD_MODE_CAST_SHAPE);
|
||||
ps->body_set_state(body,Physics2DServer::BODY_STATE_TRANSFORM,p_xform);
|
||||
|
||||
// print_line("add body with xform: "+p_xform);
|
||||
|
||||
@@ -240,6 +240,7 @@ bool Globals::_load_resource_pack(const String& p_pack) {
|
||||
|
||||
//if data.pck is found, all directory access will be from here
|
||||
DirAccess::make_default<DirAccessPack>(DirAccess::ACCESS_RESOURCES);
|
||||
using_datapack=true;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1327,6 +1328,10 @@ void Globals::set_disable_platform_override(bool p_disable) {
|
||||
disable_platform_override=p_disable;
|
||||
}
|
||||
|
||||
bool Globals::is_using_datapack() const {
|
||||
|
||||
return using_datapack;
|
||||
}
|
||||
|
||||
void Globals::_bind_methods() {
|
||||
|
||||
@@ -1439,6 +1444,8 @@ Globals::Globals() {
|
||||
custom_prop_info["render/mipmap_policy"]=PropertyInfo(Variant::INT,"render/mipmap_policy",PROPERTY_HINT_ENUM,"Allow,Allow For Po2,Disallow");
|
||||
custom_prop_info["render/thread_model"]=PropertyInfo(Variant::INT,"render/thread_model",PROPERTY_HINT_ENUM,"Single-Unsafe,Single-Safe,Multi-Threaded");
|
||||
set("display/emulate_touchscreen",false);
|
||||
|
||||
using_datapack=false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ protected:
|
||||
String resource_path;
|
||||
HashMap<String,PropertyInfo> custom_prop_info;
|
||||
bool disable_platform_override;
|
||||
bool using_datapack;
|
||||
|
||||
|
||||
bool _set(const StringName& p_name, const Variant& p_value);
|
||||
@@ -127,6 +128,8 @@ public:
|
||||
|
||||
void register_global_defaults();
|
||||
|
||||
bool is_using_datapack() const;
|
||||
|
||||
Globals();
|
||||
~Globals();
|
||||
|
||||
|
||||
+393
-393
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -115,7 +115,7 @@ private:
|
||||
Element* _nil;
|
||||
int size_cache;
|
||||
|
||||
_Data() {
|
||||
_FORCE_INLINE_ _Data() {
|
||||
#ifdef GLOBALNIL_DISABLED
|
||||
_nil = memnew_allocator( Element, A );
|
||||
_nil->parent=_nil->left=_nil->right=_nil;
|
||||
|
||||
@@ -255,6 +255,16 @@ Vector2 Vector2::cubic_interpolate(const Vector2& p_b,const Vector2& p_pre_a, co
|
||||
|
||||
}
|
||||
|
||||
Vector2 Vector2::slide(const Vector2& p_vec) const {
|
||||
|
||||
return p_vec - *this * this->dot(p_vec);
|
||||
}
|
||||
Vector2 Vector2::reflect(const Vector2& p_vec) const {
|
||||
|
||||
return p_vec - *this * this->dot(p_vec) * 2.0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool Rect2::intersects_segment(const Point2& p_from, const Point2& p_to, Point2* r_pos,Point2* r_normal) const {
|
||||
|
||||
|
||||
@@ -105,6 +105,8 @@ struct Vector2 {
|
||||
Vector2 cubic_interpolate(const Vector2& p_b,const Vector2& p_pre_a, const Vector2& p_post_b,float p_t) const;
|
||||
Vector2 cubic_interpolate_soft(const Vector2& p_b,const Vector2& p_pre_a, const Vector2& p_post_b,float p_t) const;
|
||||
|
||||
Vector2 slide(const Vector2& p_vec) const;
|
||||
Vector2 reflect(const Vector2& p_vec) const;
|
||||
|
||||
Vector2 operator+(const Vector2& p_v) const;
|
||||
void operator+=(const Vector2& p_v);
|
||||
|
||||
@@ -298,6 +298,8 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
|
||||
VCALL_LOCALMEM1R(Vector2,snapped);
|
||||
VCALL_LOCALMEM0R(Vector2,get_aspect);
|
||||
VCALL_LOCALMEM1R(Vector2,dot);
|
||||
VCALL_LOCALMEM1R(Vector2,slide);
|
||||
VCALL_LOCALMEM1R(Vector2,reflect);
|
||||
// VCALL_LOCALMEM1R(Vector2,cross);
|
||||
|
||||
VCALL_LOCALMEM0R(Rect2,get_area);
|
||||
@@ -1192,6 +1194,8 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
|
||||
ADDFUNC1(VECTOR2,VECTOR2,Vector2,snapped,VECTOR2,"by",varray());
|
||||
ADDFUNC0(VECTOR2,REAL,Vector2,get_aspect,varray());
|
||||
ADDFUNC1(VECTOR2,REAL,Vector2,dot,VECTOR2,"with",varray());
|
||||
ADDFUNC1(VECTOR2,REAL,Vector2,slide,VECTOR2,"vec",varray());
|
||||
ADDFUNC1(VECTOR2,REAL,Vector2,reflect,VECTOR2,"vec",varray());
|
||||
//ADDFUNC1(VECTOR2,REAL,Vector2,cross,VECTOR2,"with",varray());
|
||||
|
||||
ADDFUNC0(RECT2,REAL,Rect2,get_area,varray());
|
||||
|
||||
@@ -15,6 +15,7 @@ func disable():
|
||||
|
||||
func _ready():
|
||||
# Initalization here
|
||||
get_node("Timer").start()
|
||||
pass
|
||||
|
||||
|
||||
|
||||
+120
-69
@@ -1,14 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<resource_file type="PackedScene" subresource_count="5" version="0.99" version_name="Godot Engine v0.99.3037-pre-beta">
|
||||
<ext_resource path="res://bullet.png" type="Texture"></ext_resource>
|
||||
<ext_resource path="res://bullet.gd" type="GDScript"></ext_resource>
|
||||
<resource type="CircleShape2D" path="local://0">
|
||||
<string name="resource/name"> "" </string>
|
||||
<resource_file type="PackedScene" subresource_count="5" version="1.0" version_name="Godot Engine v1.0.3917-beta1">
|
||||
<ext_resource path="res://bullet.*" type="Texture"></ext_resource>
|
||||
<ext_resource path="res://bullet.*" type="Script"></ext_resource>
|
||||
<resource type="CircleShape2D" path="local://1">
|
||||
<real name="custom_solver_bias"> 0 </real>
|
||||
<real name="radius"> 10 </real>
|
||||
<resource name="script/script"></resource>
|
||||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://1">
|
||||
<resource type="Animation" path="local://2">
|
||||
<string name="resource/name"> "shutdown" </string>
|
||||
<real name="length"> 1.5 </real>
|
||||
<bool name="loop"> False </bool>
|
||||
@@ -16,13 +15,13 @@
|
||||
<string name="tracks/0/type"> "value" </string>
|
||||
<node_path name="tracks/0/path"> "particles:config/emitting" </node_path>
|
||||
<int name="tracks/0/interp"> 1 </int>
|
||||
<dictionary name="tracks/0/keys">
|
||||
<dictionary name="tracks/0/keys" shared="false">
|
||||
<string> "cont" </string>
|
||||
<bool> False </bool>
|
||||
<string> "transitions" </string>
|
||||
<real_array len="1"> 1 </real_array>
|
||||
<string> "values" </string>
|
||||
<array len="1">
|
||||
<array len="1" shared="false">
|
||||
<bool> False </bool>
|
||||
</array>
|
||||
<string> "times" </string>
|
||||
@@ -31,13 +30,13 @@
|
||||
<string name="tracks/1/type"> "value" </string>
|
||||
<node_path name="tracks/1/path"> "sprite:visibility/self_opacity" </node_path>
|
||||
<int name="tracks/1/interp"> 1 </int>
|
||||
<dictionary name="tracks/1/keys">
|
||||
<dictionary name="tracks/1/keys" shared="false">
|
||||
<string> "cont" </string>
|
||||
<bool> True </bool>
|
||||
<string> "transitions" </string>
|
||||
<real_array len="2"> 1, 1 </real_array>
|
||||
<string> "values" </string>
|
||||
<array len="2">
|
||||
<array len="2" shared="false">
|
||||
<real> 1 </real>
|
||||
<real> 0 </real>
|
||||
</array>
|
||||
@@ -47,14 +46,14 @@
|
||||
<string name="tracks/2/type"> "method" </string>
|
||||
<node_path name="tracks/2/path"> "." </node_path>
|
||||
<int name="tracks/2/interp"> 1 </int>
|
||||
<dictionary name="tracks/2/keys">
|
||||
<dictionary name="tracks/2/keys" shared="false">
|
||||
<string> "transitions" </string>
|
||||
<real_array len="1"> 1 </real_array>
|
||||
<string> "values" </string>
|
||||
<array len="1">
|
||||
<dictionary>
|
||||
<array len="1" shared="false">
|
||||
<dictionary shared="false">
|
||||
<string> "args" </string>
|
||||
<array len="0">
|
||||
<array len="0" shared="false">
|
||||
</array>
|
||||
<string> "method" </string>
|
||||
<string> "queue_free" </string>
|
||||
@@ -63,33 +62,25 @@
|
||||
<string> "times" </string>
|
||||
<real_array len="1"> 1.31 </real_array>
|
||||
</dictionary>
|
||||
<resource name="script/script"></resource>
|
||||
|
||||
</resource>
|
||||
<main_resource>
|
||||
<string name="resource/name"> "" </string>
|
||||
<dictionary name="_bundled">
|
||||
<dictionary name="_bundled" shared="false">
|
||||
<string> "names" </string>
|
||||
<string_array len="109">
|
||||
<string_array len="111">
|
||||
<string> "bullet" </string>
|
||||
<string> "RigidBody2D" </string>
|
||||
<string> "process/process" </string>
|
||||
<string> "process/fixed_process" </string>
|
||||
<string> "process/input" </string>
|
||||
<string> "process/unhandled_input" </string>
|
||||
<string> "process/mode" </string>
|
||||
<string> "visibility/visible" </string>
|
||||
<string> "visibility/toplevel" </string>
|
||||
<string> "visibility/opacity" </string>
|
||||
<string> "visibility/self_opacity" </string>
|
||||
<string> "visibility/on_top" </string>
|
||||
<string> "visibility/blend_mode" </string>
|
||||
<string> "transform/notify" </string>
|
||||
<string> "transform/pos" </string>
|
||||
<string> "transform/rot" </string>
|
||||
<string> "transform/scale" </string>
|
||||
<string> "shape_count" </string>
|
||||
<string> "shapes/0/shape" </string>
|
||||
<string> "shapes/0/transform" </string>
|
||||
<string> "shapes/0/trigger" </string>
|
||||
<string> "mode" </string>
|
||||
<string> "mass" </string>
|
||||
<string> "friction" </string>
|
||||
@@ -106,8 +97,10 @@
|
||||
<string> "__meta__" </string>
|
||||
<string> "particles" </string>
|
||||
<string> "Particles2D" </string>
|
||||
<string> "visibility/blend_mode" </string>
|
||||
<string> "config/amount" </string>
|
||||
<string> "config/lifetime" </string>
|
||||
<string> "config/time_scale" </string>
|
||||
<string> "config/preprocess" </string>
|
||||
<string> "config/emit_timeout" </string>
|
||||
<string> "config/emitting" </string>
|
||||
@@ -115,11 +108,14 @@
|
||||
<string> "config/half_extents" </string>
|
||||
<string> "config/local_space" </string>
|
||||
<string> "config/explosiveness" </string>
|
||||
<string> "config/flip_h" </string>
|
||||
<string> "config/flip_v" </string>
|
||||
<string> "config/texture" </string>
|
||||
<string> "params/direction" </string>
|
||||
<string> "params/spread" </string>
|
||||
<string> "params/linear_velocity" </string>
|
||||
<string> "params/spin_velocity" </string>
|
||||
<string> "params/orbit_velocity" </string>
|
||||
<string> "params/gravity_direction" </string>
|
||||
<string> "params/gravity_strength" </string>
|
||||
<string> "params/radial_accel" </string>
|
||||
@@ -132,6 +128,7 @@
|
||||
<string> "randomness/spread" </string>
|
||||
<string> "randomness/linear_velocity" </string>
|
||||
<string> "randomness/spin_velocity" </string>
|
||||
<string> "randomness/orbit_velocity" </string>
|
||||
<string> "randomness/gravity_direction" </string>
|
||||
<string> "randomness/gravity_strength" </string>
|
||||
<string> "randomness/radial_accel" </string>
|
||||
@@ -149,6 +146,7 @@
|
||||
<string> "phase_2/color" </string>
|
||||
<string> "phase_3/pos" </string>
|
||||
<string> "phase_3/color" </string>
|
||||
<string> "emission_points" </string>
|
||||
<string> "sprite" </string>
|
||||
<string> "Sprite" </string>
|
||||
<string> "texture" </string>
|
||||
@@ -164,6 +162,7 @@
|
||||
<string> "region_rect" </string>
|
||||
<string> "CollisionShape2D" </string>
|
||||
<string> "shape" </string>
|
||||
<string> "trigger" </string>
|
||||
<string> "Timer" </string>
|
||||
<string> "wait_time" </string>
|
||||
<string> "one_shot" </string>
|
||||
@@ -173,8 +172,9 @@
|
||||
<string> "playback/process_mode" </string>
|
||||
<string> "playback/default_blend_time" </string>
|
||||
<string> "root/root" </string>
|
||||
<string> "speed" </string>
|
||||
<string> "anims/shutdown" </string>
|
||||
<string> "playback/active" </string>
|
||||
<string> "playback/speed" </string>
|
||||
<string> "blend_times" </string>
|
||||
<string> "autoplay" </string>
|
||||
<string> "disable" </string>
|
||||
@@ -187,99 +187,150 @@
|
||||
<string> "node_count" </string>
|
||||
<int> 6 </int>
|
||||
<string> "variants" </string>
|
||||
<array len="27">
|
||||
<bool> False </bool>
|
||||
<int> 0 </int>
|
||||
<array len="27" shared="false">
|
||||
<bool> True </bool>
|
||||
<real> 1 </real>
|
||||
<vector2> 0, 0 </vector2>
|
||||
<real> 0 </real>
|
||||
<vector2> 1, 1 </vector2>
|
||||
<int> 1 </int>
|
||||
<resource resource_type="CircleShape2D" path="local://0"> </resource>
|
||||
<resource resource_type="Shape2D" path="local://1"> </resource>
|
||||
<matrix32> 1, 0, 0, 1, 0, 0 </matrix32>
|
||||
<resource resource_type="GDScript" path="res://bullet.gd"> </resource>
|
||||
<dictionary>
|
||||
<bool> False </bool>
|
||||
<int> 0 </int>
|
||||
<int> 2 </int>
|
||||
<resource resource_type="Script" path="res://bullet.*"> </resource>
|
||||
<dictionary shared="false">
|
||||
<string> "__editor_plugin_states__" </string>
|
||||
<dictionary>
|
||||
<dictionary shared="false">
|
||||
<string> "Script" </string>
|
||||
<dictionary>
|
||||
<dictionary shared="false">
|
||||
<string> "current" </string>
|
||||
<int> 0 </int>
|
||||
<int> 2 </int>
|
||||
<string> "sources" </string>
|
||||
<array len="3">
|
||||
<array len="3" shared="false">
|
||||
<string> "res://enemy.gd" </string>
|
||||
<string> "res://player.gd" </string>
|
||||
<string> "res://bullet.gd" </string>
|
||||
</array>
|
||||
</dictionary>
|
||||
<string> "2D" </string>
|
||||
<dictionary>
|
||||
<dictionary shared="false">
|
||||
<string> "pixel_snap" </string>
|
||||
<bool> False </bool>
|
||||
<string> "zoom" </string>
|
||||
<real> 3.424785 </real>
|
||||
<string> "ofs" </string>
|
||||
<vector2> -74.7573, -35.9676 </vector2>
|
||||
</dictionary>
|
||||
<string> "3D" </string>
|
||||
<dictionary>
|
||||
<dictionary shared="false">
|
||||
<string> "zfar" </string>
|
||||
<real> 500 </real>
|
||||
<string> "fov" </string>
|
||||
<real> 45 </real>
|
||||
<string> "window_mode" </string>
|
||||
<int> 0 </int>
|
||||
<string> "window_0" </string>
|
||||
<dictionary>
|
||||
<string> "distance" </string>
|
||||
<real> 10.07268 </real>
|
||||
<string> "default_light" </string>
|
||||
<bool> True </bool>
|
||||
<string> "x_rot" </string>
|
||||
<real> 0.337 </real>
|
||||
<string> "y_rot" </string>
|
||||
<real> -0.575 </real>
|
||||
<string> "show_grid" </string>
|
||||
<bool> True </bool>
|
||||
<string> "show_origin" </string>
|
||||
<bool> True </bool>
|
||||
<string> "pos" </string>
|
||||
<vector3> 0, 0, 0 </vector3>
|
||||
</dictionary>
|
||||
<string> "viewports" </string>
|
||||
<array len="4" shared="false">
|
||||
<dictionary shared="false">
|
||||
<string> "distance" </string>
|
||||
<real> 4 </real>
|
||||
<string> "x_rot" </string>
|
||||
<real> 0 </real>
|
||||
<string> "y_rot" </string>
|
||||
<real> 0 </real>
|
||||
<string> "use_orthogonal" </string>
|
||||
<bool> False </bool>
|
||||
<string> "use_environment" </string>
|
||||
<bool> False </bool>
|
||||
<string> "pos" </string>
|
||||
<vector3> 0, 0, 0 </vector3>
|
||||
</dictionary>
|
||||
<dictionary shared="false">
|
||||
<string> "distance" </string>
|
||||
<real> 4 </real>
|
||||
<string> "x_rot" </string>
|
||||
<real> 0 </real>
|
||||
<string> "y_rot" </string>
|
||||
<real> 0 </real>
|
||||
<string> "use_orthogonal" </string>
|
||||
<bool> False </bool>
|
||||
<string> "use_environment" </string>
|
||||
<bool> False </bool>
|
||||
<string> "pos" </string>
|
||||
<vector3> 0, 0, 0 </vector3>
|
||||
</dictionary>
|
||||
<dictionary shared="false">
|
||||
<string> "distance" </string>
|
||||
<real> 4 </real>
|
||||
<string> "x_rot" </string>
|
||||
<real> 0 </real>
|
||||
<string> "y_rot" </string>
|
||||
<real> 0 </real>
|
||||
<string> "use_orthogonal" </string>
|
||||
<bool> False </bool>
|
||||
<string> "use_environment" </string>
|
||||
<bool> False </bool>
|
||||
<string> "pos" </string>
|
||||
<vector3> 0, 0, 0 </vector3>
|
||||
</dictionary>
|
||||
<dictionary shared="false">
|
||||
<string> "distance" </string>
|
||||
<real> 4 </real>
|
||||
<string> "x_rot" </string>
|
||||
<real> 0 </real>
|
||||
<string> "y_rot" </string>
|
||||
<real> 0 </real>
|
||||
<string> "use_orthogonal" </string>
|
||||
<bool> False </bool>
|
||||
<string> "use_environment" </string>
|
||||
<bool> False </bool>
|
||||
<string> "pos" </string>
|
||||
<vector3> 0, 0, 0 </vector3>
|
||||
</dictionary>
|
||||
</array>
|
||||
<string> "viewport_mode" </string>
|
||||
<int> 1 </int>
|
||||
<string> "default_light" </string>
|
||||
<bool> True </bool>
|
||||
<string> "show_grid" </string>
|
||||
<bool> True </bool>
|
||||
<string> "show_origin" </string>
|
||||
<bool> True </bool>
|
||||
<string> "znear" </string>
|
||||
<real> 0.1 </real>
|
||||
</dictionary>
|
||||
</dictionary>
|
||||
<string> "__editor_run_settings__" </string>
|
||||
<dictionary>
|
||||
<dictionary shared="false">
|
||||
<string> "custom_args" </string>
|
||||
<string> "-l $scene" </string>
|
||||
<string> "run_mode" </string>
|
||||
<int> 0 </int>
|
||||
</dictionary>
|
||||
<string> "__editor_plugin_screen__" </string>
|
||||
<string> "Script" </string>
|
||||
<string> "2D" </string>
|
||||
</dictionary>
|
||||
<real> 0.559322 </real>
|
||||
<int> 24 </int>
|
||||
<real> 0.1 </real>
|
||||
<resource resource_type="Texture" path="res://bullet.png"> </resource>
|
||||
<resource resource_type="Texture" path="res://bullet.*"> </resource>
|
||||
<real> 10 </real>
|
||||
<int> 2 </int>
|
||||
<color> 1, 1, 1, 1 </color>
|
||||
<color> 1, 0, 0, 0 </color>
|
||||
<color> 0, 0, 0, 1 </color>
|
||||
<resource name=""></resource> <rect2> 0, 0, 0, 0 </rect2>
|
||||
<vector2_array len="0"> </vector2_array>
|
||||
<rect2> 0, 0, 0, 0 </rect2>
|
||||
<node_path> ".." </node_path>
|
||||
<resource resource_type="Animation" path="local://1"> </resource>
|
||||
<array len="0">
|
||||
<resource resource_type="Animation" path="local://2"> </resource>
|
||||
<array len="0" shared="false">
|
||||
</array>
|
||||
<string> "" </string>
|
||||
</array>
|
||||
<string> "nodes" </string>
|
||||
<int_array len="356"> -1, -1, 1, 0, -1, 32, 2, 0, 3, 0, 4, 0, 5, 0, 6, 1, 7, 2, 8, 0, 9, 3, 10, 3, 11, 2, 12, 1, 13, 2, 14, 4, 15, 5, 16, 6, 17, 7, 18, 8, 19, 9, 20, 1, 21, 3, 22, 3, 23, 5, 24, 0, 25, 0, 26, 1, 27, 0, 28, 2, 29, 2, 30, 4, 31, 5, 32, 10, 33, 11, 0, 0, 0, 35, 34, -1, 59, 2, 2, 3, 0, 4, 0, 5, 0, 6, 1, 7, 2, 8, 0, 9, 12, 10, 3, 11, 2, 12, 7, 13, 0, 14, 4, 15, 5, 16, 6, 36, 13, 37, 14, 38, 5, 39, 5, 40, 2, 41, 4, 42, 4, 43, 0, 44, 3, 45, 15, 46, 5, 47, 16, 48, 5, 49, 5, 50, 5, 51, 5, 52, 5, 53, 5, 54, 5, 55, 3, 56, 5, 57, 5, 58, 5, 59, 5, 60, 5, 61, 5, 62, 5, 63, 5, 64, 5, 65, 5, 66, 5, 67, 5, 68, 5, 69, 5, 70, 17, 71, 5, 72, 18, 73, 3, 74, 19, 75, 3, 76, 20, 77, 3, 78, 20, 32, 21, 0, 0, 0, 80, 79, -1, 27, 2, 0, 3, 0, 4, 0, 5, 0, 6, 1, 7, 2, 8, 0, 9, 3, 10, 3, 11, 2, 12, 1, 13, 0, 14, 4, 15, 5, 16, 6, 81, 15, 82, 2, 83, 4, 84, 0, 85, 0, 86, 7, 87, 7, 88, 1, 89, 18, 90, 0, 91, 22, 32, 21, 0, 0, 0, 92, 92, -1, 17, 2, 0, 3, 0, 4, 0, 5, 0, 6, 1, 7, 2, 8, 0, 9, 3, 10, 3, 11, 2, 12, 1, 13, 2, 14, 4, 15, 5, 16, 6, 93, 8, 32, 21, 0, 0, 0, 94, 94, -1, 9, 2, 0, 3, 0, 4, 0, 5, 0, 6, 1, 95, 3, 96, 2, 97, 2, 32, 21, 0, 0, 0, 99, 98, -1, 13, 2, 0, 3, 0, 4, 0, 5, 0, 6, 1, 100, 7, 101, 5, 102, 23, 103, 3, 104, 24, 105, 25, 106, 26, 32, 21, 0 </int_array>
|
||||
<int_array len="282"> -1, -1, 1, 0, -1, 25, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 9, 5, 10, 6, 11, 7, 12, 8, 13, 9, 14, 1, 15, 1, 16, 3, 17, 8, 18, 10, 19, 9, 20, 8, 21, 0, 22, 0, 23, 2, 24, 3, 25, 11, 26, 12, 0, 0, 0, 28, 27, -1, 57, 2, 0, 3, 13, 4, 1, 5, 0, 29, 5, 6, 2, 7, 3, 8, 4, 30, 14, 31, 15, 32, 1, 33, 3, 34, 3, 35, 0, 36, 2, 37, 2, 38, 8, 39, 1, 40, 8, 41, 8, 42, 16, 43, 3, 44, 17, 45, 3, 46, 3, 47, 3, 48, 3, 49, 3, 50, 3, 51, 3, 52, 3, 53, 1, 54, 3, 55, 3, 56, 3, 57, 3, 58, 3, 59, 3, 60, 3, 61, 3, 62, 3, 63, 3, 64, 3, 65, 3, 66, 3, 67, 3, 68, 3, 69, 10, 70, 3, 71, 18, 72, 1, 73, 19, 74, 1, 75, 20, 76, 1, 77, 20, 78, 21, 0, 0, 0, 80, 79, -1, 18, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 81, 16, 82, 0, 83, 2, 84, 8, 85, 8, 86, 5, 87, 5, 88, 9, 89, 18, 90, 8, 91, 22, 0, 0, 0, 92, 92, -1, 9, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 93, 6, 94, 8, 0, 0, 0, 95, 95, -1, 3, 96, 1, 97, 0, 98, 8, 0, 0, 0, 100, 99, -1, 8, 101, 5, 102, 3, 103, 23, 104, 24, 105, 0, 106, 1, 107, 25, 108, 26, 0 </int_array>
|
||||
<string> "conns" </string>
|
||||
<int_array len="6"> 4, 0, 108, 107, 2, 0 </int_array>
|
||||
<int_array len="6"> 4, 0, 110, 109, 2, 0 </int_array>
|
||||
</dictionary>
|
||||
<resource name="script/script"></resource>
|
||||
|
||||
</main_resource>
|
||||
</resource_file>
|
||||
@@ -95,3 +95,4 @@ func _ready():
|
||||
rc_right=get_node("raycast_right")
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<main_resource>
|
||||
<dictionary name="_bundled" shared="false">
|
||||
<string> "names" </string>
|
||||
<string_array len="39">
|
||||
<string_array len="46">
|
||||
<string> "moving_platform" </string>
|
||||
<string> "Node2D" </string>
|
||||
<string> "visibility/visible" </string>
|
||||
@@ -25,16 +25,23 @@
|
||||
<string> "motion" </string>
|
||||
<string> "cycle" </string>
|
||||
<string> "platform" </string>
|
||||
<string> "StaticBody2D" </string>
|
||||
<string> "RigidBody2D" </string>
|
||||
<string> "shape_count" </string>
|
||||
<string> "shapes/0/shape" </string>
|
||||
<string> "shapes/0/transform" </string>
|
||||
<string> "shapes/0/trigger" </string>
|
||||
<string> "simulate_motion" </string>
|
||||
<string> "constant_linear_velocity" </string>
|
||||
<string> "constant_angular_velocity" </string>
|
||||
<string> "mode" </string>
|
||||
<string> "mass" </string>
|
||||
<string> "friction" </string>
|
||||
<string> "bounce" </string>
|
||||
<string> "custom_integrator" </string>
|
||||
<string> "continuous_cd" </string>
|
||||
<string> "contacts_reported" </string>
|
||||
<string> "contact_monitor" </string>
|
||||
<string> "active" </string>
|
||||
<string> "can_sleep" </string>
|
||||
<string> "velocity/linear" </string>
|
||||
<string> "velocity/angular" </string>
|
||||
<string> "Sprite" </string>
|
||||
<string> "texture" </string>
|
||||
<string> "centered" </string>
|
||||
@@ -58,7 +65,7 @@
|
||||
<string> "node_count" </string>
|
||||
<int> 4 </int>
|
||||
<string> "variants" </string>
|
||||
<array len="16" shared="false">
|
||||
<array len="17" shared="false">
|
||||
<bool> True </bool>
|
||||
<real> 1 </real>
|
||||
<vector2> 0, 0 </vector2>
|
||||
@@ -180,14 +187,15 @@
|
||||
<resource resource_type="Shape2D" path="local://1"> </resource>
|
||||
<matrix32> 1, -0, 0, 1, 0, 0 </matrix32>
|
||||
<bool> False </bool>
|
||||
<resource resource_type="Texture" path="res://moving_platform.*"> </resource>
|
||||
<int> 3 </int>
|
||||
<int> 0 </int>
|
||||
<resource resource_type="Texture" path="res://moving_platform.*"> </resource>
|
||||
<color> 1, 1, 1, 1 </color>
|
||||
<rect2> 0, 0, 0, 0 </rect2>
|
||||
<vector2_array len="4"> -88, -24, 88, -24, 88, 24, -88, 24 </vector2_array>
|
||||
</array>
|
||||
<string> "nodes" </string>
|
||||
<int_array len="136"> -1, -1, 1, 0, -1, 11, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 9, 5, 10, 6, 11, 2, 12, 1, 0, 0, 0, 14, 13, -1, 16, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 15, 7, 16, 8, 17, 9, 18, 10, 19, 0, 20, 2, 21, 3, 22, 1, 23, 3, 0, 1, 0, 24, 24, -1, 18, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 25, 11, 26, 0, 27, 2, 28, 10, 29, 10, 30, 7, 31, 7, 32, 12, 33, 13, 34, 10, 35, 14, 0, 1, 0, 36, 36, -1, 9, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 37, 12, 38, 15, 0 </int_array>
|
||||
<int_array len="150"> -1, -1, 1, 0, -1, 11, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 9, 5, 10, 6, 11, 2, 12, 1, 0, 0, 0, 14, 13, -1, 23, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 15, 7, 16, 8, 17, 9, 18, 10, 19, 11, 20, 1, 21, 1, 22, 3, 23, 10, 24, 10, 25, 12, 26, 10, 27, 0, 28, 0, 29, 2, 30, 3, 0, 1, 0, 31, 31, -1, 18, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 32, 13, 33, 0, 34, 2, 35, 10, 36, 10, 37, 7, 38, 7, 39, 12, 40, 14, 41, 10, 42, 15, 0, 1, 0, 43, 43, -1, 9, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 44, 12, 45, 16, 0 </int_array>
|
||||
<string> "conns" </string>
|
||||
<int_array len="0"> </int_array>
|
||||
</dictionary>
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<resource_file type="PackedScene" subresource_count="24" version="1.0" version_name="Godot Engine v1.0.3917-beta1">
|
||||
<ext_resource path="res://robot_demo.*" type="Texture"></ext_resource>
|
||||
<ext_resource path="res://player.*" type="Script"></ext_resource>
|
||||
<ext_resource path="res://sound_shoot.*" type="Sample"></ext_resource>
|
||||
<ext_resource path="res://sound_coin.*" type="Sample"></ext_resource>
|
||||
<ext_resource path="res://osb_right.*" type="Texture"></ext_resource>
|
||||
<ext_resource path="res://sound_jump.*" type="Sample"></ext_resource>
|
||||
<ext_resource path="res://osb_left.*" type="Texture"></ext_resource>
|
||||
<ext_resource path="res://bullet.*" type="Texture"></ext_resource>
|
||||
<ext_resource path="res://osb_jump.*" type="Texture"></ext_resource>
|
||||
<ext_resource path="res://player.*" type="Script"></ext_resource>
|
||||
<ext_resource path="res://osb_right.*" type="Texture"></ext_resource>
|
||||
<ext_resource path="res://sound_coin.*" type="Sample"></ext_resource>
|
||||
<ext_resource path="res://sound_jump.*" type="Sample"></ext_resource>
|
||||
<ext_resource path="res://sound_shoot.*" type="Sample"></ext_resource>
|
||||
<ext_resource path="res://bullet.*" type="Texture"></ext_resource>
|
||||
<ext_resource path="res://osb_fire.*" type="Texture"></ext_resource>
|
||||
<ext_resource path="res://osb_left.*" type="Texture"></ext_resource>
|
||||
<resource type="RayShape2D" path="local://1">
|
||||
<real name="custom_solver_bias"> 0.5 </real>
|
||||
<real name="length"> 20 </real>
|
||||
@@ -101,50 +101,6 @@
|
||||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://6">
|
||||
<string name="resource/name"> "falling_weapon" </string>
|
||||
<real name="length"> 0.5 </real>
|
||||
<bool name="loop"> True </bool>
|
||||
<real name="step"> 0.25 </real>
|
||||
<string name="tracks/0/type"> "value" </string>
|
||||
<node_path name="tracks/0/path"> "sprite:frame" </node_path>
|
||||
<int name="tracks/0/interp"> 1 </int>
|
||||
<dictionary name="tracks/0/keys" shared="false">
|
||||
<string> "cont" </string>
|
||||
<bool> False </bool>
|
||||
<string> "transitions" </string>
|
||||
<real_array len="1"> 1 </real_array>
|
||||
<string> "values" </string>
|
||||
<array len="1" shared="false">
|
||||
<int> 26 </int>
|
||||
</array>
|
||||
<string> "times" </string>
|
||||
<real_array len="1"> 0 </real_array>
|
||||
</dictionary>
|
||||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://7">
|
||||
<string name="resource/name"> "falling" </string>
|
||||
<real name="length"> 0.01 </real>
|
||||
<bool name="loop"> True </bool>
|
||||
<real name="step"> 0.25 </real>
|
||||
<string name="tracks/0/type"> "value" </string>
|
||||
<node_path name="tracks/0/path"> "sprite:frame" </node_path>
|
||||
<int name="tracks/0/interp"> 1 </int>
|
||||
<dictionary name="tracks/0/keys" shared="false">
|
||||
<string> "cont" </string>
|
||||
<bool> False </bool>
|
||||
<string> "transitions" </string>
|
||||
<real_array len="1"> 1 </real_array>
|
||||
<string> "values" </string>
|
||||
<array len="1" shared="false">
|
||||
<int> 21 </int>
|
||||
</array>
|
||||
<string> "times" </string>
|
||||
<real_array len="1"> 0 </real_array>
|
||||
</dictionary>
|
||||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://8">
|
||||
<string name="resource/name"> "run_weapon" </string>
|
||||
<real name="length"> 1.25 </real>
|
||||
<bool name="loop"> True </bool>
|
||||
@@ -171,9 +127,9 @@
|
||||
</dictionary>
|
||||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://9">
|
||||
<string name="resource/name"> "run_gun_fire" </string>
|
||||
<real name="length"> 1.25 </real>
|
||||
<resource type="Animation" path="local://7">
|
||||
<string name="resource/name"> "falling" </string>
|
||||
<real name="length"> 0.01 </real>
|
||||
<bool name="loop"> True </bool>
|
||||
<real name="step"> 0.25 </real>
|
||||
<string name="tracks/0/type"> "value" </string>
|
||||
@@ -183,18 +139,57 @@
|
||||
<string> "cont" </string>
|
||||
<bool> False </bool>
|
||||
<string> "transitions" </string>
|
||||
<real_array len="6"> 1, 1, 1, 1, 1, 1 </real_array>
|
||||
<real_array len="1"> 1 </real_array>
|
||||
<string> "values" </string>
|
||||
<array len="6" shared="false">
|
||||
<int> 10 </int>
|
||||
<int> 11 </int>
|
||||
<int> 12 </int>
|
||||
<int> 13 </int>
|
||||
<int> 14 </int>
|
||||
<int> 5 </int>
|
||||
<array len="1" shared="false">
|
||||
<int> 21 </int>
|
||||
</array>
|
||||
<string> "times" </string>
|
||||
<real_array len="6"> 0, 0.25, 0.5, 0.75, 1, 1.25 </real_array>
|
||||
<real_array len="1"> 0 </real_array>
|
||||
</dictionary>
|
||||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://8">
|
||||
<string name="resource/name"> "falling_weapon" </string>
|
||||
<real name="length"> 0.5 </real>
|
||||
<bool name="loop"> True </bool>
|
||||
<real name="step"> 0.25 </real>
|
||||
<string name="tracks/0/type"> "value" </string>
|
||||
<node_path name="tracks/0/path"> "sprite:frame" </node_path>
|
||||
<int name="tracks/0/interp"> 1 </int>
|
||||
<dictionary name="tracks/0/keys" shared="false">
|
||||
<string> "cont" </string>
|
||||
<bool> False </bool>
|
||||
<string> "transitions" </string>
|
||||
<real_array len="1"> 1 </real_array>
|
||||
<string> "values" </string>
|
||||
<array len="1" shared="false">
|
||||
<int> 26 </int>
|
||||
</array>
|
||||
<string> "times" </string>
|
||||
<real_array len="1"> 0 </real_array>
|
||||
</dictionary>
|
||||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://9">
|
||||
<string name="resource/name"> "idle_weapon" </string>
|
||||
<real name="length"> 0.5 </real>
|
||||
<bool name="loop"> True </bool>
|
||||
<real name="step"> 0.25 </real>
|
||||
<string name="tracks/0/type"> "value" </string>
|
||||
<node_path name="tracks/0/path"> "sprite:frame" </node_path>
|
||||
<int name="tracks/0/interp"> 1 </int>
|
||||
<dictionary name="tracks/0/keys" shared="false">
|
||||
<string> "cont" </string>
|
||||
<bool> False </bool>
|
||||
<string> "transitions" </string>
|
||||
<real_array len="1"> 1 </real_array>
|
||||
<string> "values" </string>
|
||||
<array len="1" shared="false">
|
||||
<int> 25 </int>
|
||||
</array>
|
||||
<string> "times" </string>
|
||||
<real_array len="1"> 0 </real_array>
|
||||
</dictionary>
|
||||
|
||||
</resource>
|
||||
@@ -243,8 +238,8 @@
|
||||
|
||||
</resource>
|
||||
<resource type="Animation" path="local://12">
|
||||
<string name="resource/name"> "idle_weapon" </string>
|
||||
<real name="length"> 0.5 </real>
|
||||
<string name="resource/name"> "run_gun_fire" </string>
|
||||
<real name="length"> 1.25 </real>
|
||||
<bool name="loop"> True </bool>
|
||||
<real name="step"> 0.25 </real>
|
||||
<string name="tracks/0/type"> "value" </string>
|
||||
@@ -254,13 +249,18 @@
|
||||
<string> "cont" </string>
|
||||
<bool> False </bool>
|
||||
<string> "transitions" </string>
|
||||
<real_array len="1"> 1 </real_array>
|
||||
<real_array len="6"> 1, 1, 1, 1, 1, 1 </real_array>
|
||||
<string> "values" </string>
|
||||
<array len="1" shared="false">
|
||||
<int> 25 </int>
|
||||
<array len="6" shared="false">
|
||||
<int> 10 </int>
|
||||
<int> 11 </int>
|
||||
<int> 12 </int>
|
||||
<int> 13 </int>
|
||||
<int> 14 </int>
|
||||
<int> 5 </int>
|
||||
</array>
|
||||
<string> "times" </string>
|
||||
<real_array len="1"> 0 </real_array>
|
||||
<real_array len="6"> 0, 0.25, 0.5, 0.75, 1, 1.25 </real_array>
|
||||
</dictionary>
|
||||
|
||||
</resource>
|
||||
@@ -294,7 +294,7 @@
|
||||
<main_resource>
|
||||
<dictionary name="_bundled" shared="false">
|
||||
<string> "names" </string>
|
||||
<string_array len="167">
|
||||
<string_array len="170">
|
||||
<string> "player" </string>
|
||||
<string> "RigidBody2D" </string>
|
||||
<string> "visibility/visible" </string>
|
||||
@@ -351,6 +351,8 @@
|
||||
<string> "config/half_extents" </string>
|
||||
<string> "config/local_space" </string>
|
||||
<string> "config/explosiveness" </string>
|
||||
<string> "config/flip_h" </string>
|
||||
<string> "config/flip_v" </string>
|
||||
<string> "config/texture" </string>
|
||||
<string> "params/direction" </string>
|
||||
<string> "params/spread" </string>
|
||||
@@ -396,19 +398,20 @@
|
||||
<string> "anims/idle" </string>
|
||||
<string> "anims/jumping" </string>
|
||||
<string> "anims/run" </string>
|
||||
<string> "anims/falling_weapon" </string>
|
||||
<string> "anims/falling" </string>
|
||||
<string> "anims/run_weapon" </string>
|
||||
<string> "anims/standing_weapon_ready" </string>
|
||||
<string> "anims/falling" </string>
|
||||
<string> "anims/falling_weapon" </string>
|
||||
<string> "anims/idle_weapon" </string>
|
||||
<string> "anims/jumping_weapon" </string>
|
||||
<string> "anims/crouch" </string>
|
||||
<string> "anims/idle_weapon" </string>
|
||||
<string> "anims/standing_weapon_ready" </string>
|
||||
<string> "playback/active" </string>
|
||||
<string> "playback/speed" </string>
|
||||
<string> "blend_times" </string>
|
||||
<string> "autoplay" </string>
|
||||
<string> "camera" </string>
|
||||
<string> "Camera2D" </string>
|
||||
<string> "rotating" </string>
|
||||
<string> "current" </string>
|
||||
<string> "smoothing" </string>
|
||||
<string> "zoom" </string>
|
||||
@@ -651,7 +654,7 @@
|
||||
<string> "shoot" </string>
|
||||
</array>
|
||||
<string> "nodes" </string>
|
||||
<int_array len="566"> -1, -1, 1, 0, -1, 28, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 9, 5, 10, 6, 11, 7, 12, 8, 13, 9, 14, 10, 15, 8, 16, 5, 17, 11, 18, 3, 19, 3, 20, 0, 21, 8, 22, 12, 23, 8, 24, 0, 25, 0, 26, 2, 27, 3, 28, 13, 29, 14, 0, 0, 0, 31, 30, -1, 18, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 32, 15, 33, 0, 34, 2, 35, 8, 36, 8, 37, 5, 38, 16, 39, 17, 40, 18, 41, 8, 42, 19, 0, 1, 0, 44, 43, -1, 55, 2, 0, 3, 1, 4, 20, 5, 0, 45, 17, 6, 21, 7, 22, 8, 4, 46, 23, 47, 24, 48, 1, 49, 3, 50, 24, 51, 8, 52, 2, 53, 2, 54, 8, 55, 25, 56, 26, 57, 3, 58, 27, 59, 28, 60, 1, 61, 3, 62, 3, 63, 29, 64, 3, 65, 3, 66, 3, 67, 30, 68, 30, 69, 3, 70, 3, 71, 3, 72, 3, 73, 30, 74, 3, 75, 3, 76, 3, 77, 3, 78, 3, 79, 3, 80, 3, 81, 3, 82, 3, 83, 5, 84, 3, 85, 18, 86, 1, 87, 31, 88, 1, 89, 32, 90, 1, 91, 33, 92, 34, 0, 0, 0, 94, 93, -1, 17, 95, 17, 96, 3, 97, 35, 98, 36, 99, 37, 100, 38, 101, 39, 102, 40, 103, 41, 104, 42, 105, 43, 106, 44, 107, 45, 108, 0, 109, 30, 110, 46, 111, 47, 0, 0, 0, 113, 112, -1, 21, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 33, 0, 114, 0, 115, 3, 116, 4, 117, 48, 118, 48, 119, 49, 120, 49, 121, 0, 122, 0, 123, 50, 124, 50, 125, 50, 126, 50, 0, 0, 0, 128, 127, -1, 7, 2, 0, 3, 1, 4, 1, 5, 0, 6, 51, 7, 3, 8, 4, 0, 0, 0, 129, 129, -1, 9, 2, 0, 3, 1, 4, 1, 5, 0, 6, 52, 7, 3, 8, 53, 130, 6, 131, 8, 0, 0, 0, 133, 132, -1, 14, 134, 12, 135, 54, 136, 3, 137, 1, 138, 3, 139, 3, 140, 3, 141, 55, 142, 55, 143, 55, 144, 55, 145, 5, 146, 3, 147, 3, 0, 0, 0, 148, 148, -1, 9, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 149, 48, 150, 56, 0, 0, 0, 152, 151, -1, 4, 153, 48, 34, 2, 154, 3, 155, 4, 0, 9, 0, 157, 156, -1, 13, 2, 0, 3, 1, 4, 1, 5, 0, 6, 57, 7, 3, 8, 58, 158, 59, 159, 60, 160, 60, 161, 0, 162, 61, 163, 17, 0, 9, 0, 157, 164, -1, 13, 2, 0, 3, 1, 4, 1, 5, 0, 6, 62, 7, 3, 8, 58, 158, 63, 159, 60, 160, 60, 161, 0, 162, 64, 163, 17, 0, 9, 0, 157, 165, -1, 13, 2, 0, 3, 1, 4, 1, 5, 0, 6, 65, 7, 3, 8, 58, 158, 66, 159, 60, 160, 60, 161, 8, 162, 67, 163, 17, 0, 9, 0, 157, 166, -1, 13, 2, 0, 3, 1, 4, 1, 5, 0, 6, 68, 7, 3, 8, 58, 158, 69, 159, 60, 160, 60, 161, 8, 162, 70, 163, 17, 0 </int_array>
|
||||
<int_array len="572"> -1, -1, 1, 0, -1, 28, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 9, 5, 10, 6, 11, 7, 12, 8, 13, 9, 14, 10, 15, 8, 16, 5, 17, 11, 18, 3, 19, 3, 20, 0, 21, 8, 22, 12, 23, 8, 24, 0, 25, 0, 26, 2, 27, 3, 28, 13, 29, 14, 0, 0, 0, 31, 30, -1, 18, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 32, 15, 33, 0, 34, 2, 35, 8, 36, 8, 37, 5, 38, 16, 39, 17, 40, 18, 41, 8, 42, 19, 0, 1, 0, 44, 43, -1, 57, 2, 0, 3, 1, 4, 20, 5, 0, 45, 17, 6, 21, 7, 22, 8, 4, 46, 23, 47, 24, 48, 1, 49, 3, 50, 24, 51, 8, 52, 2, 53, 2, 54, 8, 55, 25, 56, 8, 57, 8, 58, 26, 59, 3, 60, 27, 61, 28, 62, 1, 63, 3, 64, 3, 65, 29, 66, 3, 67, 3, 68, 3, 69, 30, 70, 30, 71, 3, 72, 3, 73, 3, 74, 3, 75, 30, 76, 3, 77, 3, 78, 3, 79, 3, 80, 3, 81, 3, 82, 3, 83, 3, 84, 3, 85, 5, 86, 3, 87, 18, 88, 1, 89, 31, 90, 1, 91, 32, 92, 1, 93, 33, 94, 34, 0, 0, 0, 96, 95, -1, 17, 97, 17, 98, 3, 99, 35, 100, 36, 101, 37, 102, 38, 103, 39, 104, 40, 105, 41, 106, 42, 107, 43, 108, 44, 109, 45, 110, 0, 111, 30, 112, 46, 113, 47, 0, 0, 0, 115, 114, -1, 22, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 33, 0, 116, 8, 117, 0, 118, 3, 119, 4, 120, 48, 121, 48, 122, 49, 123, 49, 124, 0, 125, 0, 126, 50, 127, 50, 128, 50, 129, 50, 0, 0, 0, 131, 130, -1, 7, 2, 0, 3, 1, 4, 1, 5, 0, 6, 51, 7, 3, 8, 4, 0, 0, 0, 132, 132, -1, 9, 2, 0, 3, 1, 4, 1, 5, 0, 6, 52, 7, 3, 8, 53, 133, 6, 134, 8, 0, 0, 0, 136, 135, -1, 14, 137, 12, 138, 54, 139, 3, 140, 1, 141, 3, 142, 3, 143, 3, 144, 55, 145, 55, 146, 55, 147, 55, 148, 5, 149, 3, 150, 3, 0, 0, 0, 151, 151, -1, 9, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 152, 48, 153, 56, 0, 0, 0, 155, 154, -1, 4, 156, 48, 34, 2, 157, 3, 158, 4, 0, 9, 0, 160, 159, -1, 13, 2, 0, 3, 1, 4, 1, 5, 0, 6, 57, 7, 3, 8, 58, 161, 59, 162, 60, 163, 60, 164, 0, 165, 61, 166, 17, 0, 9, 0, 160, 167, -1, 13, 2, 0, 3, 1, 4, 1, 5, 0, 6, 62, 7, 3, 8, 58, 161, 63, 162, 60, 163, 60, 164, 0, 165, 64, 166, 17, 0, 9, 0, 160, 168, -1, 13, 2, 0, 3, 1, 4, 1, 5, 0, 6, 65, 7, 3, 8, 58, 161, 66, 162, 60, 163, 60, 164, 8, 165, 67, 166, 17, 0, 9, 0, 160, 169, -1, 13, 2, 0, 3, 1, 4, 1, 5, 0, 6, 68, 7, 3, 8, 58, 161, 69, 162, 60, 163, 60, 164, 8, 165, 70, 166, 17, 0 </int_array>
|
||||
<string> "conns" </string>
|
||||
<int_array len="0"> </int_array>
|
||||
</dictionary>
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<resource_file type="PackedScene" subresource_count="9" version="0.99" version_name="Godot Engine v0.99.3735-pre-beta">
|
||||
<ext_resource path="res://music.*" type="AudioStreamOGGVorbis"></ext_resource>
|
||||
<resource_file type="PackedScene" subresource_count="9" version="1.0" version_name="Godot Engine v1.0.3917-beta1">
|
||||
<ext_resource path="res://music.*" type="AudioStream"></ext_resource>
|
||||
<ext_resource path="res://tileset.*" type="TileSet"></ext_resource>
|
||||
<ext_resource path="res://seesaw.*" type="PackedScene"></ext_resource>
|
||||
<ext_resource path="res://player.*" type="PackedScene"></ext_resource>
|
||||
<ext_resource path="res://coin.*" type="PackedScene"></ext_resource>
|
||||
<ext_resource path="res://enemy.*" type="PackedScene"></ext_resource>
|
||||
<ext_resource path="res://player.*" type="PackedScene"></ext_resource>
|
||||
<ext_resource path="res://moving_platform.*" type="PackedScene"></ext_resource>
|
||||
<ext_resource path="res://enemy.*" type="PackedScene"></ext_resource>
|
||||
<ext_resource path="res://seesaw.*" type="PackedScene"></ext_resource>
|
||||
<ext_resource path="res://parallax_bg.*" type="PackedScene"></ext_resource>
|
||||
<main_resource>
|
||||
<dictionary name="_bundled" shared="false">
|
||||
<string> "names" </string>
|
||||
<string_array len="92">
|
||||
<string_array len="118">
|
||||
<string> "stage" </string>
|
||||
<string> "Node" </string>
|
||||
<string> "__meta__" </string>
|
||||
@@ -104,15 +104,41 @@
|
||||
<string> "enemy 15" </string>
|
||||
<string> "parallax_bg" </string>
|
||||
<string> "ParallaxBackground" </string>
|
||||
<string> "Label" </string>
|
||||
<string> "margin/left" </string>
|
||||
<string> "margin/top" </string>
|
||||
<string> "margin/right" </string>
|
||||
<string> "margin/bottom" </string>
|
||||
<string> "focus_neighbour/left" </string>
|
||||
<string> "focus_neighbour/top" </string>
|
||||
<string> "focus_neighbour/right" </string>
|
||||
<string> "focus_neighbour/bottom" </string>
|
||||
<string> "focus/ignore_mouse" </string>
|
||||
<string> "focus/stop_mouse" </string>
|
||||
<string> "size_flags/horizontal" </string>
|
||||
<string> "size_flags/stretch_ratio" </string>
|
||||
<string> "range/min" </string>
|
||||
<string> "range/max" </string>
|
||||
<string> "range/step" </string>
|
||||
<string> "range/page" </string>
|
||||
<string> "range/value" </string>
|
||||
<string> "range/exp_edit" </string>
|
||||
<string> "rounded_values" </string>
|
||||
<string> "text" </string>
|
||||
<string> "align" </string>
|
||||
<string> "valign" </string>
|
||||
<string> "autowrap" </string>
|
||||
<string> "uppercase" </string>
|
||||
<string> "percent_visible" </string>
|
||||
</string_array>
|
||||
<string> "version" </string>
|
||||
<int> 1 </int>
|
||||
<string> "conn_count" </string>
|
||||
<int> 0 </int>
|
||||
<string> "node_count" </string>
|
||||
<int> 65 </int>
|
||||
<int> 66 </int>
|
||||
<string> "variants" </string>
|
||||
<array len="84" shared="false">
|
||||
<array len="95" shared="false">
|
||||
<dictionary shared="false">
|
||||
<string> "__editor_plugin_states__" </string>
|
||||
<dictionary shared="false">
|
||||
@@ -133,9 +159,9 @@
|
||||
<string> "pixel_snap" </string>
|
||||
<bool> False </bool>
|
||||
<string> "zoom" </string>
|
||||
<real> 0.598736 </real>
|
||||
<real> 1.108033 </real>
|
||||
<string> "ofs" </string>
|
||||
<vector2> -37.7393, 205.061 </vector2>
|
||||
<vector2> -19.8136, -223.194 </vector2>
|
||||
</dictionary>
|
||||
<string> "3D" </string>
|
||||
<dictionary shared="false">
|
||||
@@ -297,7 +323,7 @@
|
||||
<vector2> 450, 0 </vector2>
|
||||
<resource resource_type="PackedScene" path="res://seesaw.*"> </resource>
|
||||
<vector2> 2402.79, 849.52 </vector2>
|
||||
<resource resource_type="AudioStreamOGGVorbis" path="res://music.*"> </resource>
|
||||
<resource resource_type="AudioStream" path="res://music.*"> </resource>
|
||||
<bool> False </bool>
|
||||
<real> 2 </real>
|
||||
<resource resource_type="PackedScene" path="res://enemy.*"> </resource>
|
||||
@@ -313,9 +339,20 @@
|
||||
<vector2> 3546.2, 1356.19 </vector2>
|
||||
<vector2> 2406.63, 815.115 </vector2>
|
||||
<resource resource_type="PackedScene" path="res://parallax_bg.*"> </resource>
|
||||
<real> 12 </real>
|
||||
<real> -202 </real>
|
||||
<real> 358 </real>
|
||||
<real> -10 </real>
|
||||
<node_path> "" </node_path>
|
||||
<int> 2 </int>
|
||||
<real> 14 </real>
|
||||
<real> 14.769231 </real>
|
||||
<string> "This is a simple demo on how to make a platformer game with Godot. This version uses physics and the 2D physics engine for motion and collision. The demo also shows the benefits of using the scene system, where coins, enemies and the player are edited separatedly and instanced in the stage. To edit the base tiles for the tileset, open the tileset_edit.xml file and follow instructions. " </string>
|
||||
<int> 0 </int>
|
||||
<real> -1 </real>
|
||||
</array>
|
||||
<string> "nodes" </string>
|
||||
<int_array len="623"> -1, -1, 1, 0, -1, 1, 2, 0, 0, 0, 0, 4, 3, -1, 12, 5, 1, 6, 2, 7, 2, 8, 1, 9, 3, 10, 4, 11, 5, 12, 6, 13, 7, 14, 8, 15, 9, 2, 10, 0, 0, 0, 1, 16, -1, 1, 2, 11, 0, 2, 0, 18, 17, 12, 1, 9, 13, 0, 2, 0, 18, 19, 12, 1, 9, 14, 0, 2, 0, 18, 20, 12, 1, 9, 15, 0, 2, 0, 18, 21, 12, 1, 9, 16, 0, 2, 0, 18, 22, 12, 1, 9, 17, 0, 2, 0, 18, 23, 12, 1, 9, 18, 0, 2, 0, 18, 24, 12, 1, 9, 19, 0, 2, 0, 18, 25, 12, 1, 9, 20, 0, 2, 0, 18, 26, 12, 1, 9, 21, 0, 2, 0, 18, 27, 12, 1, 9, 22, 0, 2, 0, 18, 28, 12, 1, 9, 23, 0, 2, 0, 18, 29, 12, 1, 9, 24, 0, 2, 0, 18, 30, 12, 1, 9, 25, 0, 2, 0, 18, 31, 12, 1, 9, 26, 0, 2, 0, 18, 32, 12, 1, 9, 27, 0, 2, 0, 18, 33, 12, 1, 9, 28, 0, 2, 0, 18, 34, 12, 1, 9, 29, 0, 2, 0, 18, 35, 12, 1, 9, 30, 0, 2, 0, 18, 36, 12, 1, 9, 31, 0, 2, 0, 18, 37, 12, 1, 9, 32, 0, 2, 0, 18, 38, 12, 1, 9, 33, 0, 2, 0, 18, 39, 12, 1, 9, 34, 0, 2, 0, 18, 40, 12, 1, 9, 35, 0, 2, 0, 18, 41, 12, 1, 9, 36, 0, 2, 0, 18, 42, 12, 1, 9, 37, 0, 2, 0, 18, 43, 12, 1, 9, 38, 0, 2, 0, 18, 44, 12, 1, 9, 39, 0, 2, 0, 18, 45, 12, 1, 9, 40, 0, 2, 0, 18, 46, 12, 1, 9, 41, 0, 2, 0, 18, 47, 12, 1, 9, 42, 0, 2, 0, 18, 48, 12, 1, 9, 43, 0, 2, 0, 18, 49, 12, 1, 9, 44, 0, 2, 0, 18, 50, 12, 1, 9, 45, 0, 2, 0, 18, 51, 12, 1, 9, 46, 0, 2, 0, 18, 52, 12, 1, 9, 47, 0, 2, 0, 18, 53, 12, 1, 9, 48, 0, 2, 0, 18, 54, 12, 1, 9, 49, 0, 2, 0, 18, 55, 12, 1, 9, 50, 0, 2, 0, 18, 56, 12, 1, 9, 51, 0, 2, 0, 18, 57, 12, 1, 9, 52, 0, 2, 0, 18, 58, 12, 1, 9, 53, 0, 2, 0, 18, 59, 12, 1, 9, 54, 0, 0, 0, 61, 60, 55, 1, 9, 56, 0, 0, 0, 1, 62, -1, 0, 0, 46, 0, 64, 63, 57, 3, 9, 58, 65, 59, 66, 60, 0, 46, 0, 64, 67, 57, 3, 9, 61, 65, 62, 66, 63, 0, 46, 0, 64, 68, 57, 3, 9, 64, 65, 65, 66, 63, 0, 46, 0, 64, 69, 66, 1, 9, 67, 0, 0, 0, 71, 70, -1, 6, 72, 68, 73, 69, 74, 1, 75, 70, 76, 1, 77, 69, 0, 0, 0, 1, 78, -1, 0, 0, 52, 0, 61, 79, 71, 1, 9, 72, 0, 52, 0, 61, 80, 71, 1, 9, 73, 0, 52, 0, 61, 81, 71, 1, 9, 74, 0, 52, 0, 61, 82, 71, 1, 9, 75, 0, 52, 0, 61, 83, 71, 1, 9, 76, 0, 52, 0, 61, 84, 71, 1, 9, 77, 0, 52, 0, 61, 85, 71, 1, 9, 78, 0, 52, 0, 61, 86, 71, 1, 9, 79, 0, 52, 0, 61, 87, 71, 1, 9, 80, 0, 52, 0, 61, 88, 71, 1, 9, 81, 0, 52, 0, 61, 89, 71, 1, 9, 82, 0, 0, 0, 91, 90, 83, 0, 0 </int_array>
|
||||
<int_array len="688"> -1, -1, 1, 0, -1, 1, 2, 0, 0, 0, 0, 4, 3, -1, 12, 5, 1, 6, 2, 7, 2, 8, 1, 9, 3, 10, 4, 11, 5, 12, 6, 13, 7, 14, 8, 15, 9, 2, 10, 0, 0, 0, 1, 16, -1, 1, 2, 11, 0, 2, 0, 18, 17, 12, 1, 9, 13, 0, 2, 0, 18, 19, 12, 1, 9, 14, 0, 2, 0, 18, 20, 12, 1, 9, 15, 0, 2, 0, 18, 21, 12, 1, 9, 16, 0, 2, 0, 18, 22, 12, 1, 9, 17, 0, 2, 0, 18, 23, 12, 1, 9, 18, 0, 2, 0, 18, 24, 12, 1, 9, 19, 0, 2, 0, 18, 25, 12, 1, 9, 20, 0, 2, 0, 18, 26, 12, 1, 9, 21, 0, 2, 0, 18, 27, 12, 1, 9, 22, 0, 2, 0, 18, 28, 12, 1, 9, 23, 0, 2, 0, 18, 29, 12, 1, 9, 24, 0, 2, 0, 18, 30, 12, 1, 9, 25, 0, 2, 0, 18, 31, 12, 1, 9, 26, 0, 2, 0, 18, 32, 12, 1, 9, 27, 0, 2, 0, 18, 33, 12, 1, 9, 28, 0, 2, 0, 18, 34, 12, 1, 9, 29, 0, 2, 0, 18, 35, 12, 1, 9, 30, 0, 2, 0, 18, 36, 12, 1, 9, 31, 0, 2, 0, 18, 37, 12, 1, 9, 32, 0, 2, 0, 18, 38, 12, 1, 9, 33, 0, 2, 0, 18, 39, 12, 1, 9, 34, 0, 2, 0, 18, 40, 12, 1, 9, 35, 0, 2, 0, 18, 41, 12, 1, 9, 36, 0, 2, 0, 18, 42, 12, 1, 9, 37, 0, 2, 0, 18, 43, 12, 1, 9, 38, 0, 2, 0, 18, 44, 12, 1, 9, 39, 0, 2, 0, 18, 45, 12, 1, 9, 40, 0, 2, 0, 18, 46, 12, 1, 9, 41, 0, 2, 0, 18, 47, 12, 1, 9, 42, 0, 2, 0, 18, 48, 12, 1, 9, 43, 0, 2, 0, 18, 49, 12, 1, 9, 44, 0, 2, 0, 18, 50, 12, 1, 9, 45, 0, 2, 0, 18, 51, 12, 1, 9, 46, 0, 2, 0, 18, 52, 12, 1, 9, 47, 0, 2, 0, 18, 53, 12, 1, 9, 48, 0, 2, 0, 18, 54, 12, 1, 9, 49, 0, 2, 0, 18, 55, 12, 1, 9, 50, 0, 2, 0, 18, 56, 12, 1, 9, 51, 0, 2, 0, 18, 57, 12, 1, 9, 52, 0, 2, 0, 18, 58, 12, 1, 9, 53, 0, 2, 0, 18, 59, 12, 1, 9, 54, 0, 0, 0, 61, 60, 55, 1, 9, 56, 0, 0, 0, 1, 62, -1, 0, 0, 46, 0, 64, 63, 57, 3, 9, 58, 65, 59, 66, 60, 0, 46, 0, 64, 67, 57, 3, 9, 61, 65, 62, 66, 63, 0, 46, 0, 64, 68, 57, 3, 9, 64, 65, 65, 66, 63, 0, 46, 0, 64, 69, 66, 1, 9, 67, 0, 0, 0, 71, 70, -1, 6, 72, 68, 73, 69, 74, 1, 75, 70, 76, 1, 77, 69, 0, 0, 0, 1, 78, -1, 0, 0, 52, 0, 61, 79, 71, 1, 9, 72, 0, 52, 0, 61, 80, 71, 1, 9, 73, 0, 52, 0, 61, 81, 71, 1, 9, 74, 0, 52, 0, 61, 82, 71, 1, 9, 75, 0, 52, 0, 61, 83, 71, 1, 9, 76, 0, 52, 0, 61, 84, 71, 1, 9, 77, 0, 52, 0, 61, 85, 71, 1, 9, 78, 0, 52, 0, 61, 86, 71, 1, 9, 79, 0, 52, 0, 61, 87, 71, 1, 9, 80, 0, 52, 0, 61, 88, 71, 1, 9, 81, 0, 52, 0, 61, 89, 71, 1, 9, 82, 0, 0, 0, 91, 90, 83, 0, 0, 0, 0, 92, 92, -1, 29, 5, 1, 6, 2, 7, 2, 8, 1, 93, 84, 94, 85, 95, 86, 96, 87, 97, 88, 98, 88, 99, 88, 100, 88, 101, 1, 102, 1, 103, 89, 104, 2, 105, 4, 106, 90, 107, 2, 108, 91, 109, 4, 110, 69, 111, 69, 112, 92, 113, 93, 114, 93, 115, 1, 116, 69, 117, 94, 0 </int_array>
|
||||
<string> "conns" </string>
|
||||
<int_array len="0"> </int_array>
|
||||
</dictionary>
|
||||
|
||||
File diff suppressed because one or more lines are too long
+10
-4
@@ -11027,6 +11027,9 @@
|
||||
<return type="Vector2">
|
||||
</return>
|
||||
<description>
|
||||
Return the global, unscaled, screen pointer coordinates.
|
||||
If the 2D viewport has been scaled, it may not work well
|
||||
with [Camera] or controls.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_mouse_speed" qualifiers="const" >
|
||||
@@ -15411,6 +15414,7 @@
|
||||
<brief_description>
|
||||
</brief_description>
|
||||
<description>
|
||||
explain ownership, and that node does not need to own itself
|
||||
</description>
|
||||
<methods>
|
||||
<method name="pack" >
|
||||
@@ -15419,6 +15423,8 @@
|
||||
<argument index="0" name="path" type="Node">
|
||||
</argument>
|
||||
<description>
|
||||
Pack will ignore any sub-nodes not owned by given
|
||||
node. See [Node.set_owner].
|
||||
</description>
|
||||
</method>
|
||||
<method name="instance" qualifiers="const" >
|
||||
@@ -17490,7 +17496,7 @@
|
||||
</constant>
|
||||
<constant name="BODY_MODE_STATIC" value="0">
|
||||
</constant>
|
||||
<constant name="BODY_MODE_STATIC_ACTIVE" value="1">
|
||||
<constant name="BODY_MODE_KINEMATIC" value="1">
|
||||
</constant>
|
||||
<constant name="BODY_MODE_RIGID" value="2">
|
||||
</constant>
|
||||
@@ -18420,7 +18426,7 @@
|
||||
</constant>
|
||||
<constant name="BODY_MODE_STATIC" value="0">
|
||||
</constant>
|
||||
<constant name="BODY_MODE_STATIC_ACTIVE" value="1">
|
||||
<constant name="BODY_MODE_KINEMATIC" value="1">
|
||||
</constant>
|
||||
<constant name="BODY_MODE_RIGID" value="2">
|
||||
</constant>
|
||||
@@ -20861,7 +20867,7 @@
|
||||
<constants>
|
||||
<constant name="MODE_STATIC" value="1">
|
||||
</constant>
|
||||
<constant name="MODE_STATIC_ACTIVE" value="3">
|
||||
<constant name="MODE_KINEMATIC" value="3">
|
||||
</constant>
|
||||
<constant name="MODE_RIGID" value="0">
|
||||
</constant>
|
||||
@@ -21143,7 +21149,7 @@
|
||||
<constant name="MODE_STATIC" value="1">
|
||||
Static mode (does not move, can't be moved).
|
||||
</constant>
|
||||
<constant name="MODE_STATIC_ACTIVE" value="3">
|
||||
<constant name="MODE_KINEMATIC" value="3">
|
||||
</constant>
|
||||
<constant name="MODE_RIGID" value="0">
|
||||
Rigid body, can move and rotate.
|
||||
|
||||
@@ -7511,7 +7511,7 @@ void RasterizerGLES2::init() {
|
||||
pvr_supported=extensions.has("GL_IMG_texture_compression_pvrtc");
|
||||
etc_supported=extensions.has("GL_OES_compressed_ETC1_RGB8_texture");
|
||||
use_depth24 = extensions.has("GL_OES_depth24");
|
||||
s3tc_supported = extensions.has("GL_EXT_texture_compression_dxt1") || extensions.has("GL_EXT_texture_compression_s3tc");
|
||||
s3tc_supported = extensions.has("GL_EXT_texture_compression_dxt1") || extensions.has("GL_EXT_texture_compression_s3tc") || extensions.has("WEBGL_compressed_texture_s3tc");
|
||||
use_half_float = extensions.has("GL_OES_vertex_half_float");
|
||||
|
||||
|
||||
|
||||
+15
-9
@@ -1037,18 +1037,24 @@ bool Main::start() {
|
||||
|
||||
if (!absolute) {
|
||||
|
||||
int sep=local_game_path.find_last("/");
|
||||
if (Globals::get_singleton()->is_using_datapack()) {
|
||||
|
||||
local_game_path="res://"+local_game_path;
|
||||
|
||||
if (sep==-1) {
|
||||
DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
|
||||
local_game_path=da->get_current_dir()+"/"+local_game_path;
|
||||
memdelete(da) ;
|
||||
} else {
|
||||
int sep=local_game_path.find_last("/");
|
||||
|
||||
DirAccess *da = DirAccess::open(local_game_path.substr(0,sep));
|
||||
if (da) {
|
||||
local_game_path=da->get_current_dir()+"/"+local_game_path.substr(sep+1,local_game_path.length());;
|
||||
memdelete(da);
|
||||
if (sep==-1) {
|
||||
DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
|
||||
local_game_path=da->get_current_dir()+"/"+local_game_path;
|
||||
memdelete(da) ;
|
||||
} else {
|
||||
|
||||
DirAccess *da = DirAccess::open(local_game_path.substr(0,sep));
|
||||
if (da) {
|
||||
local_game_path=da->get_current_dir()+"/"+local_game_path.substr(sep+1,local_game_path.length());;
|
||||
memdelete(da);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -223,6 +223,7 @@ void OS_Android::process_touch(int p_what,int p_pointer, const Vector<TouchPos>&
|
||||
ev.mouse_button.y=touch[0].pos.y;
|
||||
ev.mouse_button.global_x=touch[0].pos.x;
|
||||
ev.mouse_button.global_y=touch[0].pos.y;
|
||||
input->set_mouse_pos(Point2(ev.mouse_button.x,ev.mouse_button.y));
|
||||
main_loop->input_event(ev);
|
||||
|
||||
|
||||
@@ -259,6 +260,7 @@ void OS_Android::process_touch(int p_what,int p_pointer, const Vector<TouchPos>&
|
||||
ev.mouse_button.global_x=touch[0].pos.x;
|
||||
ev.mouse_button.global_y=touch[0].pos.y;
|
||||
last_mouse=touch[0].pos;
|
||||
input->set_mouse_pos(Point2(ev.mouse_button.x,ev.mouse_button.y));
|
||||
main_loop->input_event(ev);
|
||||
}
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ static int frame_count = 0;
|
||||
printf("**************** app delegate init\n");
|
||||
CGRect rect = [[UIScreen mainScreen] bounds];
|
||||
|
||||
[application setStatusBarHidden:YES animation:NO];
|
||||
[application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
|
||||
// disable idle timer
|
||||
application.idleTimerDisabled = YES;
|
||||
|
||||
|
||||
@@ -178,10 +178,11 @@ static void _fix_files(Vector<uint8_t>& html,uint64_t p_data_size) {
|
||||
}
|
||||
|
||||
CharString cs = strnew.utf8();
|
||||
html.resize(cs.size());
|
||||
for(int i=9;i<cs.size();i++) {
|
||||
html.resize(cs.length());
|
||||
for(int i=9;i<cs.length();i++) {
|
||||
html[i]=cs[i];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct JSExportData {
|
||||
|
||||
+421
-106
File diff suppressed because it is too large
Load Diff
+73
-15
@@ -52,15 +52,8 @@ class StaticBody2D : public PhysicsBody2D {
|
||||
|
||||
OBJ_TYPE(StaticBody2D,PhysicsBody2D);
|
||||
|
||||
Matrix32 *pre_xform;
|
||||
//RID query;
|
||||
bool setting;
|
||||
bool pending;
|
||||
bool simulating_motion;
|
||||
Vector2 constant_linear_velocity;
|
||||
real_t constant_angular_velocity;
|
||||
void _update_xform();
|
||||
void _state_notify(Object *p_object);
|
||||
|
||||
real_t bounce;
|
||||
real_t friction;
|
||||
@@ -68,7 +61,6 @@ class StaticBody2D : public PhysicsBody2D {
|
||||
|
||||
protected:
|
||||
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
@@ -79,8 +71,6 @@ public:
|
||||
void set_bounce(real_t p_bounce);
|
||||
real_t get_bounce() const;
|
||||
|
||||
void set_simulate_motion(bool p_enable);
|
||||
bool is_simulating_motion() const;
|
||||
|
||||
void set_constant_linear_velocity(const Vector2& p_vel);
|
||||
void set_constant_angular_velocity(real_t p_vel);
|
||||
@@ -102,8 +92,15 @@ public:
|
||||
MODE_RIGID,
|
||||
MODE_STATIC,
|
||||
MODE_CHARACTER,
|
||||
MODE_STATIC_ACTIVE,
|
||||
MODE_KINEMATIC,
|
||||
};
|
||||
|
||||
enum CCDMode {
|
||||
CCD_MODE_DISABLED,
|
||||
CCD_MODE_CAST_RAY,
|
||||
CCD_MODE_CAST_SHAPE,
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
bool can_sleep;
|
||||
@@ -117,13 +114,14 @@ private:
|
||||
Vector2 linear_velocity;
|
||||
real_t angular_velocity;
|
||||
bool active;
|
||||
bool ccd;
|
||||
|
||||
|
||||
int max_contacts_reported;
|
||||
|
||||
bool custom_integrator;
|
||||
|
||||
CCDMode ccd_mode;
|
||||
|
||||
|
||||
struct ShapePair {
|
||||
|
||||
@@ -173,7 +171,6 @@ private:
|
||||
|
||||
protected:
|
||||
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
public:
|
||||
|
||||
@@ -215,8 +212,8 @@ public:
|
||||
void set_max_contacts_reported(int p_amount);
|
||||
int get_max_contacts_reported() const;
|
||||
|
||||
void set_use_continuous_collision_detection(bool p_enable);
|
||||
bool is_using_continuous_collision_detection() const;
|
||||
void set_continuous_collision_detection_mode(CCDMode p_mode);
|
||||
CCDMode get_continuous_collision_detection_mode() const;
|
||||
|
||||
void apply_impulse(const Vector2& p_pos, const Vector2& p_impulse);
|
||||
|
||||
@@ -229,4 +226,65 @@ public:
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(RigidBody2D::Mode);
|
||||
VARIANT_ENUM_CAST(RigidBody2D::CCDMode);
|
||||
|
||||
|
||||
|
||||
class KinematicBody2D : public PhysicsBody2D {
|
||||
|
||||
OBJ_TYPE(KinematicBody2D,PhysicsBody2D);
|
||||
|
||||
float margin;
|
||||
bool collide_static;
|
||||
bool collide_rigid;
|
||||
bool collide_kinematic;
|
||||
bool collide_character;
|
||||
|
||||
bool colliding;
|
||||
Vector2 collision;
|
||||
Vector2 normal;
|
||||
ObjectID collider;
|
||||
|
||||
|
||||
Variant _get_collider() const;
|
||||
|
||||
_FORCE_INLINE_ bool _ignores_mode(Physics2DServer::BodyMode) const;
|
||||
protected:
|
||||
|
||||
static void _bind_methods();
|
||||
public:
|
||||
|
||||
bool is_trapped() const;
|
||||
void untrap();
|
||||
|
||||
Vector2 move(const Vector2& p_motion);
|
||||
Vector2 move_to(const Vector2& p_position);
|
||||
|
||||
bool can_move_to(const Vector2& p_position);
|
||||
bool is_colliding() const;
|
||||
Vector2 get_collision_pos() const;
|
||||
Vector2 get_collision_normal() const;
|
||||
ObjectID get_collider() const;
|
||||
|
||||
void set_collide_with_static_bodies(bool p_enable);
|
||||
bool can_collide_with_static_bodies() const;
|
||||
|
||||
void set_collide_with_rigid_bodies(bool p_enable);
|
||||
bool can_collide_with_rigid_bodies() const;
|
||||
|
||||
void set_collide_with_kinematic_bodies(bool p_enable);
|
||||
bool can_collide_with_kinematic_bodies() const;
|
||||
|
||||
void set_collide_with_character_bodies(bool p_enable);
|
||||
bool can_collide_with_character_bodies() const;
|
||||
|
||||
void set_collision_margin(float p_margin);
|
||||
float get_collision_margin() const;
|
||||
|
||||
KinematicBody2D();
|
||||
~KinematicBody2D();
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // PHYSICS_BODY_2D_H
|
||||
|
||||
+1
-1
@@ -105,7 +105,7 @@ void Sprite::set_texture(const Ref<Texture>& p_texture) {
|
||||
}
|
||||
texture=p_texture;
|
||||
if (texture.is_valid()) {
|
||||
texture->set_flags(texture->get_flags()&(~Texture::FLAG_REPEAT)); //remove repeat from texture, it looks bad in sprites
|
||||
texture->set_flags(texture->get_flags()); //remove repeat from texture, it looks bad in sprites
|
||||
texture->connect(CoreStringNames::get_singleton()->changed,this,SceneStringNames::get_singleton()->update);
|
||||
}
|
||||
update();
|
||||
|
||||
@@ -181,7 +181,7 @@ void TileMap::_update_dirty_quadrants() {
|
||||
if (!tile_set->has_tile(c.id))
|
||||
continue;
|
||||
Ref<Texture> tex = tile_set->tile_get_texture(c.id);
|
||||
Vector2 tile_ofs = tile_set->tile_get_offset(c.id);
|
||||
Vector2 tile_ofs = tile_set->tile_get_texture_offset(c.id);
|
||||
|
||||
Vector2 offset = Point2( E->key().x, E->key().y )*cell_size - q.pos;
|
||||
|
||||
@@ -215,6 +215,7 @@ void TileMap::_update_dirty_quadrants() {
|
||||
rect.size.y=-rect.size.y;
|
||||
|
||||
|
||||
rect.pos+=tile_ofs;
|
||||
if (r==Rect2()) {
|
||||
|
||||
tex->draw_rect(q.canvas_item,rect);
|
||||
@@ -231,8 +232,9 @@ void TileMap::_update_dirty_quadrants() {
|
||||
Ref<Shape2D> shape = shapes[i];
|
||||
if (shape.is_valid()) {
|
||||
|
||||
Vector2 shape_ofs = tile_set->tile_get_shape_offset(c.id);
|
||||
Matrix32 xform;
|
||||
xform.set_origin(offset.floor());
|
||||
xform.set_origin(offset.floor()+shape_ofs);
|
||||
if (c.flip_h) {
|
||||
xform.elements[0]=-xform.elements[0];
|
||||
xform.elements[2].x+=s.x;
|
||||
@@ -242,6 +244,7 @@ void TileMap::_update_dirty_quadrants() {
|
||||
xform.elements[2].y+=s.y;
|
||||
}
|
||||
|
||||
|
||||
ps->body_add_shape(q.static_body,shape->get_rid(),xform);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,9 +434,9 @@ void RigidBody::set_mode(Mode p_mode) {
|
||||
PhysicsServer::get_singleton()->body_set_mode(get_rid(),PhysicsServer::BODY_MODE_CHARACTER);
|
||||
|
||||
} break;
|
||||
case MODE_STATIC_ACTIVE: {
|
||||
case MODE_KINEMATIC: {
|
||||
|
||||
PhysicsServer::get_singleton()->body_set_mode(get_rid(),PhysicsServer::BODY_MODE_STATIC_ACTIVE);
|
||||
PhysicsServer::get_singleton()->body_set_mode(get_rid(),PhysicsServer::BODY_MODE_KINEMATIC);
|
||||
} break;
|
||||
|
||||
}
|
||||
@@ -684,7 +684,7 @@ void RigidBody::_bind_methods() {
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_integrate_forces",PropertyInfo(Variant::OBJECT,"state:PhysicsDirectBodyState")));
|
||||
|
||||
ADD_PROPERTY( PropertyInfo(Variant::INT,"mode",PROPERTY_HINT_ENUM,"Rigid,Static,Character,Static Active"),_SCS("set_mode"),_SCS("get_mode"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::INT,"mode",PROPERTY_HINT_ENUM,"Rigid,Static,Character,Kinematic"),_SCS("set_mode"),_SCS("get_mode"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::REAL,"mass",PROPERTY_HINT_EXP_RANGE,"0.01,65535,0.01"),_SCS("set_mass"),_SCS("get_mass"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::REAL,"weight",PROPERTY_HINT_EXP_RANGE,"0.01,65535,0.01",PROPERTY_USAGE_EDITOR),_SCS("set_weight"),_SCS("get_weight"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::REAL,"friction",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_friction"),_SCS("get_friction"));
|
||||
@@ -704,7 +704,7 @@ void RigidBody::_bind_methods() {
|
||||
ADD_SIGNAL( MethodInfo("body_exit",PropertyInfo(Variant::OBJECT,"body")));
|
||||
|
||||
BIND_CONSTANT( MODE_STATIC );
|
||||
BIND_CONSTANT( MODE_STATIC_ACTIVE );
|
||||
BIND_CONSTANT( MODE_KINEMATIC );
|
||||
BIND_CONSTANT( MODE_RIGID );
|
||||
BIND_CONSTANT( MODE_CHARACTER );
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
MODE_RIGID,
|
||||
MODE_STATIC,
|
||||
MODE_CHARACTER,
|
||||
MODE_STATIC_ACTIVE,
|
||||
MODE_KINEMATIC,
|
||||
};
|
||||
private:
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ RES ResourceFormatLoaderImage::load(const String &p_path,const String& p_origina
|
||||
flags|=Texture::FLAG_FILTER;
|
||||
if (bool(GLOBAL_DEF("texture_import/gen_mipmaps",true)))
|
||||
flags|=Texture::FLAG_MIPMAPS;
|
||||
if (bool(GLOBAL_DEF("texture_import/repeat",true)))
|
||||
if (bool(GLOBAL_DEF("texture_import/repeat",false)))
|
||||
flags|=Texture::FLAG_REPEAT;
|
||||
|
||||
|
||||
|
||||
@@ -452,6 +452,7 @@ void register_scene_types() {
|
||||
ObjectTypeDB::register_virtual_type<PhysicsBody2D>();
|
||||
ObjectTypeDB::register_type<StaticBody2D>();
|
||||
ObjectTypeDB::register_type<RigidBody2D>();
|
||||
//ObjectTypeDB::register_type<KinematicBody2D>();
|
||||
ObjectTypeDB::register_type<Area2D>();
|
||||
ObjectTypeDB::register_type<CollisionShape2D>();
|
||||
ObjectTypeDB::register_type<CollisionPolygon2D>();
|
||||
|
||||
@@ -47,20 +47,82 @@ real_t Shape2D::get_custom_solver_bias() const{
|
||||
}
|
||||
|
||||
|
||||
bool Shape2D::collide_with_motion(const Matrix32& p_local_xform, const Vector2& p_local_motion, const Ref<Shape2D>& p_shape, const Matrix32& p_shape_xform, const Vector2 &p_shape_motion) {
|
||||
|
||||
ERR_FAIL_COND_V(p_shape.is_null(),false);
|
||||
int r;
|
||||
return Physics2DServer::get_singleton()->shape_collide(get_rid(),p_local_xform,p_local_motion,p_shape->get_rid(),p_shape_xform,p_shape_motion,NULL,0,r);
|
||||
}
|
||||
|
||||
bool Shape2D::collide(const Matrix32& p_local_xform, const Ref<Shape2D>& p_shape, const Matrix32& p_shape_xform){
|
||||
ERR_FAIL_COND_V(p_shape.is_null(),false);
|
||||
int r;
|
||||
return Physics2DServer::get_singleton()->shape_collide(get_rid(),p_local_xform,Vector2(),p_shape->get_rid(),p_shape_xform,Vector2(),NULL,0,r);
|
||||
|
||||
|
||||
}
|
||||
|
||||
Variant Shape2D::collide_with_motion_and_get_contacts(const Matrix32& p_local_xform, const Vector2& p_local_motion, const Ref<Shape2D>& p_shape, const Matrix32& p_shape_xform, const Vector2 &p_shape_motion){
|
||||
|
||||
ERR_FAIL_COND_V(p_shape.is_null(),Variant());
|
||||
const int max_contacts = 16;
|
||||
Vector2 result[max_contacts*2];
|
||||
int contacts=0;
|
||||
|
||||
if (!Physics2DServer::get_singleton()->shape_collide(get_rid(),p_local_xform,p_local_motion,p_shape->get_rid(),p_shape_xform,p_shape_motion,result,max_contacts,contacts))
|
||||
return Variant();
|
||||
|
||||
Array results;
|
||||
results.resize(contacts*2);
|
||||
for(int i=0;i<contacts;i++) {
|
||||
results[i]=result[i];
|
||||
}
|
||||
|
||||
return results;
|
||||
|
||||
}
|
||||
Variant Shape2D::collide_and_get_contacts(const Matrix32& p_local_xform, const Ref<Shape2D>& p_shape, const Matrix32& p_shape_xform){
|
||||
|
||||
ERR_FAIL_COND_V(p_shape.is_null(),Variant());
|
||||
const int max_contacts = 16;
|
||||
Vector2 result[max_contacts*2];
|
||||
int contacts=0;
|
||||
|
||||
if (!Physics2DServer::get_singleton()->shape_collide(get_rid(),p_local_xform,Vector2(),p_shape->get_rid(),p_shape_xform,Vector2(),result,max_contacts,contacts))
|
||||
return Variant();
|
||||
|
||||
Array results;
|
||||
results.resize(contacts*2);
|
||||
for(int i=0;i<contacts;i++) {
|
||||
results[i]=result[i];
|
||||
}
|
||||
|
||||
return results;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Shape2D::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_custom_solver_bias","bias"),&Shape2D::set_custom_solver_bias);
|
||||
ObjectTypeDB::bind_method(_MD("get_custom_solver_bias"),&Shape2D::get_custom_solver_bias);
|
||||
ObjectTypeDB::bind_method(_MD("collide","local_xform","with_shape:Shape2D","shape_xform"),&Shape2D::collide);
|
||||
ObjectTypeDB::bind_method(_MD("collide_with_motion","local_xform","local_motion","with_shape:Shape2D","shape_xform","shape_motion"),&Shape2D::collide_with_motion);
|
||||
ObjectTypeDB::bind_method(_MD("collide_and_get_contacts:var","local_xform","with_shape:Shape2D","shape_xform"),&Shape2D::collide_and_get_contacts);
|
||||
ObjectTypeDB::bind_method(_MD("collide_with_motion_and_get_contacts:var","local_xform","local_motion","with_shape:Shape2D","shape_xform","shape_motion"),&Shape2D::collide_and_get_contacts);
|
||||
|
||||
ADD_PROPERTY( PropertyInfo(Variant::REAL,"custom_solver_bias",PROPERTY_HINT_RANGE,"0,1,0.001"),_SCS("set_custom_solver_bias"),_SCS("get_custom_solver_bias"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Shape2D::Shape2D(const RID& p_rid) {
|
||||
shape=p_rid;
|
||||
custom_bias=0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Shape2D::~Shape2D() {
|
||||
|
||||
Physics2DServer::get_singleton()->free(shape);
|
||||
|
||||
@@ -47,6 +47,12 @@ public:
|
||||
void set_custom_solver_bias(real_t p_bias);
|
||||
real_t get_custom_solver_bias() const;
|
||||
|
||||
bool collide_with_motion(const Matrix32& p_local_xform, const Vector2& p_local_motion, const Ref<Shape2D>& p_shape, const Matrix32& p_shape_xform, const Vector2 &p_p_shape_motion);
|
||||
bool collide(const Matrix32& p_local_xform, const Ref<Shape2D>& p_shape, const Matrix32& p_shape_xform);
|
||||
|
||||
Variant collide_with_motion_and_get_contacts(const Matrix32& p_local_xform, const Vector2& p_local_motion, const Ref<Shape2D>& p_shape, const Matrix32& p_shape_xform, const Vector2 &p_p_shape_motion);
|
||||
Variant collide_and_get_contacts(const Matrix32& p_local_xform, const Ref<Shape2D>& p_shape, const Matrix32& p_shape_xform);
|
||||
|
||||
virtual RID get_rid() const;
|
||||
Shape2D();
|
||||
~Shape2D();
|
||||
|
||||
@@ -44,8 +44,10 @@ bool TileSet::_set(const StringName& p_name, const Variant& p_value) {
|
||||
tile_set_name(id,p_value);
|
||||
else if (what=="texture")
|
||||
tile_set_texture(id,p_value);
|
||||
else if (what=="offset")
|
||||
tile_set_offset(id,p_value);
|
||||
else if (what=="tex_offset")
|
||||
tile_set_texture_offset(id,p_value);
|
||||
else if (what=="shape_offset")
|
||||
tile_set_shape_offset(id,p_value);
|
||||
else if (what=="region")
|
||||
tile_set_region(id,p_value);
|
||||
else if (what=="shape")
|
||||
@@ -75,8 +77,10 @@ bool TileSet::_get(const StringName& p_name,Variant &r_ret) const{
|
||||
r_ret=tile_get_name(id);
|
||||
else if (what=="texture")
|
||||
r_ret=tile_get_texture(id);
|
||||
else if (what=="offset")
|
||||
r_ret=tile_get_offset(id);
|
||||
else if (what=="tex_offset")
|
||||
r_ret=tile_get_texture_offset(id);
|
||||
else if (what=="shape_offset")
|
||||
r_ret=tile_get_shape_offset(id);
|
||||
else if (what=="region")
|
||||
r_ret=tile_get_region(id);
|
||||
else if (what=="shape")
|
||||
@@ -98,7 +102,8 @@ void TileSet::_get_property_list( List<PropertyInfo> *p_list) const{
|
||||
String pre = itos(id)+"/";
|
||||
p_list->push_back(PropertyInfo(Variant::STRING,pre+"name"));
|
||||
p_list->push_back(PropertyInfo(Variant::OBJECT,pre+"texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"));
|
||||
p_list->push_back(PropertyInfo(Variant::VECTOR2,pre+"offset"));
|
||||
p_list->push_back(PropertyInfo(Variant::VECTOR2,pre+"tex_offset"));
|
||||
p_list->push_back(PropertyInfo(Variant::VECTOR2,pre+"shape_offset"));
|
||||
p_list->push_back(PropertyInfo(Variant::RECT2,pre+"region"));
|
||||
p_list->push_back(PropertyInfo(Variant::OBJECT,pre+"shape",PROPERTY_HINT_RESOURCE_TYPE,"Shape2D",PROPERTY_USAGE_EDITOR));
|
||||
p_list->push_back(PropertyInfo(Variant::ARRAY,pre+"shapes",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR));
|
||||
@@ -129,20 +134,34 @@ Ref<Texture> TileSet::tile_get_texture(int p_id) const {
|
||||
|
||||
}
|
||||
|
||||
void TileSet::tile_set_offset(int p_id,const Vector2 &p_offset) {
|
||||
void TileSet::tile_set_texture_offset(int p_id,const Vector2 &p_offset) {
|
||||
|
||||
ERR_FAIL_COND(!tile_map.has(p_id));
|
||||
tile_map[p_id].offset=p_offset;
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
Vector2 TileSet::tile_get_offset(int p_id) const {
|
||||
Vector2 TileSet::tile_get_texture_offset(int p_id) const {
|
||||
|
||||
ERR_FAIL_COND_V(!tile_map.has(p_id),Vector2());
|
||||
return tile_map[p_id].offset;
|
||||
|
||||
}
|
||||
|
||||
void TileSet::tile_set_shape_offset(int p_id,const Vector2 &p_offset) {
|
||||
|
||||
ERR_FAIL_COND(!tile_map.has(p_id));
|
||||
tile_map[p_id].shape_offset=p_offset;
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
Vector2 TileSet::tile_get_shape_offset(int p_id) const {
|
||||
|
||||
ERR_FAIL_COND_V(!tile_map.has(p_id),Vector2());
|
||||
return tile_map[p_id].shape_offset;
|
||||
|
||||
}
|
||||
|
||||
void TileSet::tile_set_region(int p_id,const Rect2 &p_region) {
|
||||
|
||||
ERR_FAIL_COND(!tile_map.has(p_id));
|
||||
@@ -289,8 +308,10 @@ void TileSet::_bind_methods() {
|
||||
ObjectTypeDB::bind_method(_MD("tile_get_name","id"),&TileSet::tile_get_name);
|
||||
ObjectTypeDB::bind_method(_MD("tile_set_texture","id","texture:Texture"),&TileSet::tile_set_texture);
|
||||
ObjectTypeDB::bind_method(_MD("tile_get_texture:Texture","id"),&TileSet::tile_get_texture);
|
||||
ObjectTypeDB::bind_method(_MD("tile_set_offset","id","offset"),&TileSet::tile_set_offset);
|
||||
ObjectTypeDB::bind_method(_MD("tile_get_offset","id"),&TileSet::tile_get_offset);
|
||||
ObjectTypeDB::bind_method(_MD("tile_set_texture_offset","id","texture_offset"),&TileSet::tile_set_texture_offset);
|
||||
ObjectTypeDB::bind_method(_MD("tile_get_texture_offset","id"),&TileSet::tile_get_texture_offset);
|
||||
ObjectTypeDB::bind_method(_MD("tile_set_shape_offset","id","shape_offset"),&TileSet::tile_set_shape_offset);
|
||||
ObjectTypeDB::bind_method(_MD("tile_get_shape_offset","id"),&TileSet::tile_get_shape_offset);
|
||||
ObjectTypeDB::bind_method(_MD("tile_set_region","id","region"),&TileSet::tile_set_region);
|
||||
ObjectTypeDB::bind_method(_MD("tile_get_region","id"),&TileSet::tile_get_region);
|
||||
ObjectTypeDB::bind_method(_MD("tile_set_shape","id","shape:Shape2D"),&TileSet::tile_set_shape);
|
||||
|
||||
@@ -42,6 +42,7 @@ class TileSet : public Resource {
|
||||
String name;
|
||||
Ref<Texture> texture;
|
||||
Vector2 offset;
|
||||
Vector2 shape_offset;
|
||||
Rect2i region;
|
||||
Vector<Ref<Shape2D> > shapes;
|
||||
};
|
||||
@@ -70,8 +71,11 @@ public:
|
||||
void tile_set_texture(int p_id, const Ref<Texture> &p_texture);
|
||||
Ref<Texture> tile_get_texture(int p_id) const;
|
||||
|
||||
void tile_set_offset(int p_id,const Vector2 &p_offset);
|
||||
Vector2 tile_get_offset(int p_id) const;
|
||||
void tile_set_texture_offset(int p_id,const Vector2 &p_offset);
|
||||
Vector2 tile_get_texture_offset(int p_id) const;
|
||||
|
||||
void tile_set_shape_offset(int p_id,const Vector2 &p_offset);
|
||||
Vector2 tile_get_shape_offset(int p_id) const;
|
||||
|
||||
void tile_set_region(int p_id,const Rect2 &p_region);
|
||||
Rect2 tile_get_region(int p_id) const;
|
||||
|
||||
@@ -198,7 +198,7 @@ bool BodyPairSW::setup(float p_step) {
|
||||
|
||||
|
||||
//cannot collide
|
||||
if (A->has_exception(B->get_self()) || B->has_exception(A->get_self()) || (A->get_mode()<=PhysicsServer::BODY_MODE_STATIC_ACTIVE && B->get_mode()<=PhysicsServer::BODY_MODE_STATIC_ACTIVE)) {
|
||||
if (A->has_exception(B->get_self()) || B->has_exception(A->get_self()) || (A->get_mode()<=PhysicsServer::BODY_MODE_KINEMATIC && B->get_mode()<=PhysicsServer::BODY_MODE_KINEMATIC)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+603
-603
File diff suppressed because it is too large
Load Diff
@@ -84,7 +84,7 @@ void Area2DSW::set_monitor_callback(ObjectID p_id, const StringName& p_method) {
|
||||
|
||||
void Area2DSW::set_space_override_mode(Physics2DServer::AreaSpaceOverrideMode p_mode) {
|
||||
bool do_override=p_mode!=Physics2DServer::AREA_SPACE_OVERRIDE_DISABLED;
|
||||
if (do_override==space_override_mode!=Physics2DServer::AREA_SPACE_OVERRIDE_DISABLED)
|
||||
if (do_override==(space_override_mode!=Physics2DServer::AREA_SPACE_OVERRIDE_DISABLED))
|
||||
return;
|
||||
_unregister_shapes();
|
||||
space_override_mode=p_mode;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
bool AreaPair2DSW::setup(float p_step) {
|
||||
|
||||
bool result = CollisionSolver2DSW::solve_static(body->get_shape(body_shape),body->get_transform() * body->get_shape_transform(body_shape),body->get_shape_inv_transform(body_shape) * body->get_inv_transform(),area->get_shape(area_shape),area->get_transform() * area->get_shape_transform(area_shape),area->get_shape_inv_transform(area_shape) * area->get_inv_transform(),NULL,this);
|
||||
bool result = CollisionSolver2DSW::solve(body->get_shape(body_shape),body->get_transform() * body->get_shape_transform(body_shape),Vector2(),area->get_shape(area_shape),area->get_transform() * area->get_shape_transform(area_shape),Vector2(),NULL,this);
|
||||
|
||||
if (result!=colliding) {
|
||||
|
||||
|
||||
+586
-581
File diff suppressed because it is too large
Load Diff
+318
-306
File diff suppressed because it is too large
Load Diff
@@ -46,7 +46,6 @@ void BodyPair2DSW::_contact_added_callback(const Vector2& p_point_A,const Vector
|
||||
|
||||
// check if we already have the contact
|
||||
|
||||
|
||||
Vector2 local_A = A->get_inv_transform().basis_xform(p_point_A);
|
||||
Vector2 local_B = B->get_inv_transform().basis_xform(p_point_B-offset_B);
|
||||
|
||||
@@ -61,6 +60,7 @@ void BodyPair2DSW::_contact_added_callback(const Vector2& p_point_A,const Vector
|
||||
contact.acc_tangent_impulse=0;
|
||||
contact.local_A=local_A;
|
||||
contact.local_B=local_B;
|
||||
contact.reused=true;
|
||||
contact.normal=(p_point_A-p_point_B).normalized();
|
||||
|
||||
// attempt to determine if the contact will be reused
|
||||
@@ -77,7 +77,7 @@ void BodyPair2DSW::_contact_added_callback(const Vector2& p_point_A,const Vector
|
||||
contact.acc_normal_impulse=c.acc_normal_impulse;
|
||||
contact.acc_tangent_impulse=c.acc_tangent_impulse;
|
||||
contact.acc_bias_impulse=c.acc_bias_impulse;
|
||||
new_index=i;
|
||||
new_index=i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -139,12 +139,26 @@ void BodyPair2DSW::_validate_contacts() {
|
||||
|
||||
Contact& c = contacts[i];
|
||||
|
||||
Vector2 global_A = A->get_transform().basis_xform(c.local_A);
|
||||
Vector2 global_B = B->get_transform().basis_xform(c.local_B)+offset_B;
|
||||
Vector2 axis = global_A - global_B;
|
||||
float depth = axis.dot( c.normal );
|
||||
bool erase=false;
|
||||
if (c.reused==false) {
|
||||
//was left behind in previous frame
|
||||
erase=true;
|
||||
} else {
|
||||
c.reused=false;
|
||||
|
||||
if (depth < -max_separation || (global_B + c.normal * depth - global_A).length_squared() > max_separation2) {
|
||||
Vector2 global_A = A->get_transform().basis_xform(c.local_A);
|
||||
Vector2 global_B = B->get_transform().basis_xform(c.local_B)+offset_B;
|
||||
Vector2 axis = global_A - global_B;
|
||||
float depth = axis.dot( c.normal );
|
||||
|
||||
|
||||
|
||||
if (depth < -max_separation || (global_B + c.normal * depth - global_A).length_squared() > max_separation2) {
|
||||
erase=true;
|
||||
}
|
||||
}
|
||||
|
||||
if (erase) {
|
||||
// contact no longer needed, remove
|
||||
|
||||
|
||||
@@ -161,7 +175,9 @@ void BodyPair2DSW::_validate_contacts() {
|
||||
}
|
||||
|
||||
|
||||
bool BodyPair2DSW::_test_ccd(float p_step,Body2DSW *p_A, int p_shape_A,const Matrix32& p_xform_A,const Matrix32& p_xform_inv_A,Body2DSW *p_B, int p_shape_B,const Matrix32& p_xform_B,const Matrix32& p_xform_inv_B,bool p_swap_result) {
|
||||
bool BodyPair2DSW::_test_ccd(float p_step,Body2DSW *p_A, int p_shape_A,const Matrix32& p_xform_A,Body2DSW *p_B, int p_shape_B,const Matrix32& p_xform_B,bool p_swap_result) {
|
||||
|
||||
|
||||
|
||||
Vector2 motion = p_A->get_linear_velocity()*p_step;
|
||||
real_t mlen = motion.length();
|
||||
@@ -172,18 +188,24 @@ bool BodyPair2DSW::_test_ccd(float p_step,Body2DSW *p_A, int p_shape_A,const Mat
|
||||
|
||||
real_t min,max;
|
||||
p_A->get_shape(p_shape_A)->project_rangev(mnormal,p_xform_A,min,max);
|
||||
if (mlen < (max-min)*0.3) //did it move enough in this direction to even attempt raycast? let's say it should move more than 1/3 the size of the object in that axis
|
||||
bool fast_object = mlen > (max-min)*0.3; //going too fast in that direction
|
||||
|
||||
if (fast_object) { //did it move enough in this direction to even attempt raycast? let's say it should move more than 1/3 the size of the object in that axis
|
||||
return false;
|
||||
}
|
||||
|
||||
//cast a segment from support in motion normal, in the same direction of motion by motion length
|
||||
//support is the worst case collision point, so real collision happened before
|
||||
int a;
|
||||
Vector2 s[2];
|
||||
p_A->get_shape(p_shape_A)->get_supports(p_xform_A.basis_xform(mnormal).normalized(),s,a);
|
||||
Vector2 from = p_xform_A.xform(s[0]);
|
||||
Vector2 to = from + motion;
|
||||
|
||||
Vector2 local_from = p_xform_inv_B.xform(from);
|
||||
Vector2 local_to = p_xform_inv_B.xform(to);
|
||||
Matrix32 from_inv = p_xform_B.affine_inverse();
|
||||
|
||||
Vector2 local_from = from_inv.xform(from-mnormal*mlen*0.1); //start from a little inside the bounding box
|
||||
Vector2 local_to = from_inv.xform(to);
|
||||
|
||||
Vector2 rpos,rnorm;
|
||||
if (!p_B->get_shape(p_shape_B)->intersect_segment(local_from,local_to,rpos,rnorm))
|
||||
@@ -191,8 +213,11 @@ bool BodyPair2DSW::_test_ccd(float p_step,Body2DSW *p_A, int p_shape_A,const Mat
|
||||
|
||||
//ray hit something
|
||||
|
||||
|
||||
Vector2 hitpos = p_xform_B.xform(rpos);
|
||||
|
||||
Vector2 contact_A = to;
|
||||
Vector2 contact_B = p_xform_B.xform(rpos);
|
||||
Vector2 contact_B = hitpos;
|
||||
|
||||
//create a contact
|
||||
|
||||
@@ -208,41 +233,50 @@ bool BodyPair2DSW::_test_ccd(float p_step,Body2DSW *p_A, int p_shape_A,const Mat
|
||||
bool BodyPair2DSW::setup(float p_step) {
|
||||
|
||||
|
||||
//cannot collide
|
||||
if (A->is_shape_set_as_trigger(shape_A) || B->is_shape_set_as_trigger(shape_B) || A->has_exception(B->get_self()) || B->has_exception(A->get_self()) || (A->get_mode()<=Physics2DServer::BODY_MODE_KINEMATIC && B->get_mode()<=Physics2DServer::BODY_MODE_KINEMATIC)) {
|
||||
collided=false;
|
||||
return false;
|
||||
}
|
||||
|
||||
//use local A coordinates to avoid numerical issues on collision detection
|
||||
offset_B = B->get_transform().get_origin() - A->get_transform().get_origin();
|
||||
|
||||
_validate_contacts();
|
||||
|
||||
//cannot collide
|
||||
if (A->is_shape_set_as_trigger(shape_A) || B->is_shape_set_as_trigger(shape_B) || A->has_exception(B->get_self()) || B->has_exception(A->get_self()) || (A->get_mode()<=Physics2DServer::BODY_MODE_STATIC_ACTIVE && B->get_mode()<=Physics2DServer::BODY_MODE_STATIC_ACTIVE)) {
|
||||
collided=false;
|
||||
|
||||
return false;
|
||||
}
|
||||
Vector2 offset_A = A->get_transform().get_origin();
|
||||
Matrix32 xform_Au = A->get_transform().untranslated();
|
||||
Matrix32 xform_A = xform_Au * A->get_shape_transform(shape_A);
|
||||
Matrix32 xform_inv_A = xform_A.affine_inverse();
|
||||
|
||||
Matrix32 xform_Bu = B->get_transform();
|
||||
xform_Bu.elements[2]-=A->get_transform().get_origin();
|
||||
Matrix32 xform_B = xform_Bu * B->get_shape_transform(shape_B);
|
||||
Matrix32 xform_inv_B = xform_B.affine_inverse();
|
||||
|
||||
Shape2DSW *shape_A_ptr=A->get_shape(shape_A);
|
||||
Shape2DSW *shape_B_ptr=B->get_shape(shape_B);
|
||||
|
||||
collided = CollisionSolver2DSW::solve_static(shape_A_ptr,xform_A,xform_inv_A,shape_B_ptr,xform_B,xform_inv_B,_add_contact,this,&sep_axis);
|
||||
Vector2 motion_A,motion_B;
|
||||
|
||||
if (A->get_continuous_collision_detection_mode()==Physics2DServer::CCD_MODE_CAST_SHAPE) {
|
||||
motion_A=A->get_motion();
|
||||
}
|
||||
if (B->get_continuous_collision_detection_mode()==Physics2DServer::CCD_MODE_CAST_SHAPE) {
|
||||
motion_B=B->get_motion();
|
||||
}
|
||||
//faster to set than to check..
|
||||
|
||||
collided = CollisionSolver2DSW::solve(shape_A_ptr,xform_A,motion_A,shape_B_ptr,xform_B,motion_B,_add_contact,this,&sep_axis);
|
||||
if (!collided) {
|
||||
|
||||
//test ccd (currently just a raycast)
|
||||
if (A->is_continuous_collision_detection_enabled() && A->get_type()>Physics2DServer::BODY_MODE_STATIC_ACTIVE) {
|
||||
if (_test_ccd(p_step,A,shape_A,xform_A,xform_inv_A,B,shape_B,xform_B,xform_inv_B))
|
||||
|
||||
if (A->get_continuous_collision_detection_mode()==Physics2DServer::CCD_MODE_CAST_RAY && A->get_mode()>Physics2DServer::BODY_MODE_KINEMATIC) {
|
||||
if (_test_ccd(p_step,A,shape_A,xform_A,B,shape_B,xform_B))
|
||||
collided=true;
|
||||
}
|
||||
|
||||
if (B->is_continuous_collision_detection_enabled() && B->get_type()>Physics2DServer::BODY_MODE_STATIC_ACTIVE) {
|
||||
if (_test_ccd(p_step,B,shape_B,xform_B,xform_inv_B,A,shape_A,xform_A,xform_inv_A,true))
|
||||
if (B->get_continuous_collision_detection_mode()==Physics2DServer::CCD_MODE_CAST_RAY && B->get_mode()>Physics2DServer::BODY_MODE_KINEMATIC) {
|
||||
if (_test_ccd(p_step,B,shape_B,xform_B,A,shape_A,xform_A,true))
|
||||
collided=true;
|
||||
}
|
||||
|
||||
@@ -251,8 +285,6 @@ bool BodyPair2DSW::setup(float p_step) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
real_t max_penetration = space->get_contact_max_allowed_penetration();
|
||||
|
||||
float bias = 0.3f;
|
||||
@@ -280,7 +312,7 @@ bool BodyPair2DSW::setup(float p_step) {
|
||||
|
||||
real_t depth = c.normal.dot(global_A - global_B);
|
||||
|
||||
if (depth<=0) {
|
||||
if (depth<=0 || !c.reused) {
|
||||
c.active=false;
|
||||
continue;
|
||||
}
|
||||
@@ -311,7 +343,6 @@ bool BodyPair2DSW::setup(float p_step) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Precompute normal mass, tangent mass, and bias.
|
||||
real_t rnA = c.rA.dot(c.normal);
|
||||
real_t rnB = c.rB.dot(c.normal);
|
||||
@@ -373,6 +404,7 @@ void BodyPair2DSW::solve(float p_step) {
|
||||
Vector2 crbB( -B->get_biased_angular_velocity() * c.rB.y, B->get_biased_angular_velocity() * c.rB.x );
|
||||
Vector2 dbv = B->get_biased_linear_velocity() + crbB - A->get_biased_linear_velocity() - crbA;
|
||||
|
||||
|
||||
real_t vn = dv.dot(c.normal);
|
||||
real_t vbn = dbv.dot(c.normal);
|
||||
Vector2 tangent = c.normal.tangent();
|
||||
@@ -388,7 +420,7 @@ void BodyPair2DSW::solve(float p_step) {
|
||||
A->apply_bias_impulse(c.rA,-jb);
|
||||
B->apply_bias_impulse(c.rB, jb);
|
||||
|
||||
real_t bounce=0;
|
||||
real_t bounce=MAX(A->get_bounce(),B->get_bounce());
|
||||
real_t jn = -(bounce + vn)*c.mass_normal;
|
||||
real_t jnOld = c.acc_normal_impulse;
|
||||
c.acc_normal_impulse = MAX(jnOld + jn, 0.0f);
|
||||
@@ -403,7 +435,6 @@ void BodyPair2DSW::solve(float p_step) {
|
||||
|
||||
Vector2 j =c.normal * (c.acc_normal_impulse - jnOld) + tangent * ( c.acc_tangent_impulse - jtOld );
|
||||
|
||||
|
||||
A->apply_impulse(c.rA,-j);
|
||||
B->apply_impulse(c.rB, j);
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ class BodyPair2DSW : public Constraint2DSW {
|
||||
real_t depth;
|
||||
bool active;
|
||||
Vector2 rA,rB;
|
||||
bool reused;
|
||||
};
|
||||
|
||||
Vector2 offset_B; //use local A coordinates to avoid numerical issues on collision detection
|
||||
@@ -76,7 +77,7 @@ class BodyPair2DSW : public Constraint2DSW {
|
||||
int cc;
|
||||
|
||||
|
||||
bool _test_ccd(float p_step,Body2DSW *p_A, int p_shape_A,const Matrix32& p_xform_A,const Matrix32& p_xform_inv_A,Body2DSW *p_B, int p_shape_B,const Matrix32& p_xform_B,const Matrix32& p_xform_inv_B,bool p_swap_result=false);
|
||||
bool _test_ccd(float p_step,Body2DSW *p_A, int p_shape_A,const Matrix32& p_xform_A,Body2DSW *p_B, int p_shape_B,const Matrix32& p_xform_B,bool p_swap_result=false);
|
||||
void _validate_contacts();
|
||||
static void _add_contact(const Vector2& p_point_A,const Vector2& p_point_B,void *p_self);
|
||||
_FORCE_INLINE_ void _contact_added_callback(const Vector2& p_point_A,const Vector2& p_point_B);
|
||||
|
||||
@@ -378,7 +378,8 @@ int BroadPhase2DHashGrid::get_subindex(ID p_id) const {
|
||||
return E->get().subindex;
|
||||
}
|
||||
|
||||
void BroadPhase2DHashGrid::_cull(const Point2i p_cell,CollisionObject2DSW** p_results,int p_max_results,int *p_result_indices,int &index) {
|
||||
template<bool use_aabb,bool use_segment>
|
||||
void BroadPhase2DHashGrid::_cull(const Point2i p_cell,const Rect2& p_aabb,const Point2& p_from, const Point2& p_to,CollisionObject2DSW** p_results,int p_max_results,int *p_result_indices,int &index) {
|
||||
|
||||
|
||||
PosKey pk;
|
||||
@@ -411,10 +412,18 @@ void BroadPhase2DHashGrid::_cull(const Point2i p_cell,CollisionObject2DSW** p_re
|
||||
continue;
|
||||
|
||||
E->key()->pass=pass;
|
||||
|
||||
if (use_aabb && !p_aabb.intersects(E->key()->aabb))
|
||||
continue;
|
||||
|
||||
if (use_segment && !E->key()->aabb.intersects_segment(p_from,p_to))
|
||||
continue;
|
||||
|
||||
p_results[index]=E->key()->owner;
|
||||
p_result_indices[index]=E->key()->subindex;
|
||||
index++;
|
||||
|
||||
|
||||
}
|
||||
|
||||
for(Map<Element*,RC>::Element *E=pb->static_object_set.front();E;E=E->next()) {
|
||||
@@ -425,6 +434,12 @@ void BroadPhase2DHashGrid::_cull(const Point2i p_cell,CollisionObject2DSW** p_re
|
||||
if (E->key()->pass==pass)
|
||||
continue;
|
||||
|
||||
if (use_aabb && !p_aabb.intersects(E->key()->aabb))
|
||||
continue;
|
||||
|
||||
if (use_segment && !E->key()->aabb.intersects_segment(p_from,p_to))
|
||||
continue;
|
||||
|
||||
E->key()->pass=pass;
|
||||
p_results[index]=E->key()->owner;
|
||||
p_result_indices[index]=E->key()->subindex;
|
||||
@@ -468,7 +483,7 @@ int BroadPhase2DHashGrid::cull_segment(const Vector2& p_from, const Vector2& p_t
|
||||
max.y= (Math::floor(pos.y + 1)*cell_size - p_from.y) / dir.y;
|
||||
|
||||
int cullcount=0;
|
||||
_cull(pos,p_results,p_max_results,p_result_indices,cullcount);
|
||||
_cull<false,true>(pos,Rect2(),p_from,p_to,p_results,p_max_results,p_result_indices,cullcount);
|
||||
|
||||
bool reached_x=false;
|
||||
bool reached_y=false;
|
||||
@@ -502,7 +517,7 @@ int BroadPhase2DHashGrid::cull_segment(const Vector2& p_from, const Vector2& p_t
|
||||
reached_y=true;
|
||||
}
|
||||
|
||||
_cull(pos,p_results,p_max_results,p_result_indices,cullcount);
|
||||
_cull<false,true>(pos,Rect2(),p_from,p_to,p_results,p_max_results,p_result_indices,cullcount);
|
||||
|
||||
if (reached_x && reached_y)
|
||||
break;
|
||||
@@ -515,8 +530,22 @@ int BroadPhase2DHashGrid::cull_segment(const Vector2& p_from, const Vector2& p_t
|
||||
|
||||
int BroadPhase2DHashGrid::cull_aabb(const Rect2& p_aabb,CollisionObject2DSW** p_results,int p_max_results,int *p_result_indices) {
|
||||
|
||||
pass++;
|
||||
|
||||
return 0;
|
||||
Point2i from = (p_aabb.pos/cell_size).floor();
|
||||
Point2i to = ((p_aabb.pos+p_aabb.size)/cell_size).floor();
|
||||
int cullcount=0;
|
||||
|
||||
for(int i=from.x;i<=to.x;i++) {
|
||||
|
||||
for(int j=from.y;j<=to.y;j++) {
|
||||
|
||||
_cull<true,false>(Point2i(i,j),p_aabb,Point2(),Point2(),p_results,p_max_results,p_result_indices,cullcount);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return cullcount;
|
||||
}
|
||||
|
||||
void BroadPhase2DHashGrid::set_pair_callback(PairCallback p_pair_callback,void *p_userdata) {
|
||||
|
||||
@@ -94,7 +94,8 @@ class BroadPhase2DHashGrid : public BroadPhase2DSW {
|
||||
|
||||
void _enter_grid(Element* p_elem, const Rect2& p_rect,bool p_static);
|
||||
void _exit_grid(Element* p_elem, const Rect2& p_rect,bool p_static);
|
||||
_FORCE_INLINE_ void _cull(const Point2i p_cell,CollisionObject2DSW** p_results,int p_max_results,int *p_result_indices,int &index);
|
||||
template<bool use_aabb,bool use_segment>
|
||||
_FORCE_INLINE_ void _cull(const Point2i p_cell,const Rect2& p_aabb,const Point2& p_from, const Point2& p_to,CollisionObject2DSW** p_results,int p_max_results,int *p_result_indices,int &index);
|
||||
|
||||
|
||||
struct PosKey {
|
||||
|
||||
@@ -130,6 +130,7 @@ void CollisionObject2DSW::_update_shapes() {
|
||||
if (!space)
|
||||
return;
|
||||
|
||||
|
||||
for(int i=0;i<shapes.size();i++) {
|
||||
|
||||
Shape &s=shapes[i];
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -32,6 +32,6 @@
|
||||
#include "collision_solver_2d_sw.h"
|
||||
|
||||
|
||||
bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Matrix32& p_transform_A, const Matrix32& p_transform_inv_A, const Shape2DSW *p_shape_B, const Matrix32& p_transform_B, const Matrix32& p_transform_inv_B, CollisionSolver2DSW::CallbackResult p_result_callback,void *p_userdata, bool p_swap=false,Vector2 *sep_axis=NULL);
|
||||
bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Matrix32& p_transform_A, const Vector2& p_motion_A,const Shape2DSW *p_shape_B, const Matrix32& p_transform_B,const Vector2& p_motion_B, CollisionSolver2DSW::CallbackResult p_result_callback,void *p_userdata, bool p_swap=false,Vector2 *sep_axis=NULL);
|
||||
|
||||
#endif // COLLISION_SOLVER_2D_SAT_H
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
//#define collision_solver gjk_epa_calculate_penetration
|
||||
|
||||
|
||||
bool CollisionSolver2DSW::solve_static_line(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Matrix32& p_transform_inv_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,const Matrix32& p_transform_inv_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result) {
|
||||
bool CollisionSolver2DSW::solve_static_line(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result) {
|
||||
|
||||
|
||||
const LineShape2DSW *line = static_cast<const LineShape2DSW*>(p_shape_A);
|
||||
@@ -49,7 +49,7 @@ bool CollisionSolver2DSW::solve_static_line(const Shape2DSW *p_shape_A,const Mat
|
||||
Vector2 supports[2];
|
||||
int support_count;
|
||||
|
||||
p_shape_B->get_supports(p_transform_inv_B.basis_xform(-n).normalized(),supports,support_count);
|
||||
p_shape_B->get_supports(p_transform_A.affine_inverse().basis_xform(-n).normalized(),supports,support_count);
|
||||
|
||||
bool found=false;
|
||||
|
||||
@@ -77,7 +77,7 @@ bool CollisionSolver2DSW::solve_static_line(const Shape2DSW *p_shape_A,const Mat
|
||||
return found;
|
||||
}
|
||||
|
||||
bool CollisionSolver2DSW::solve_raycast(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Matrix32& p_transform_inv_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,const Matrix32& p_transform_inv_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result,Vector2 *sep_axis) {
|
||||
bool CollisionSolver2DSW::solve_raycast(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result,Vector2 *sep_axis) {
|
||||
|
||||
|
||||
|
||||
@@ -89,8 +89,9 @@ bool CollisionSolver2DSW::solve_raycast(const Shape2DSW *p_shape_A,const Matrix3
|
||||
Vector2 to = from+p_transform_A[1]*ray->get_length();
|
||||
Vector2 support_A=to;
|
||||
|
||||
from = p_transform_inv_B.xform(from);
|
||||
to = p_transform_inv_B.xform(to);
|
||||
Matrix32 invb = p_transform_B.affine_inverse();
|
||||
from = invb.xform(from);
|
||||
to = invb.xform(to);
|
||||
|
||||
Vector2 p,n;
|
||||
if (!p_shape_B->intersect_segment(from,to,p,n)) {
|
||||
@@ -145,10 +146,10 @@ bool CollisionSolver2DSW::solve_ray(const Shape2DSW *p_shape_A,const Matrix32& p
|
||||
struct _ConcaveCollisionInfo2D {
|
||||
|
||||
const Matrix32 *transform_A;
|
||||
const Matrix32 *transform_inv_A;
|
||||
const Shape2DSW *shape_A;
|
||||
const Matrix32 *transform_B;
|
||||
const Matrix32 *transform_inv_B;
|
||||
Vector2 motion_A;
|
||||
Vector2 motion_B;
|
||||
CollisionSolver2DSW::CallbackResult result_callback;
|
||||
void *userdata;
|
||||
bool swap_result;
|
||||
@@ -168,7 +169,7 @@ void CollisionSolver2DSW::concave_callback(void *p_userdata, Shape2DSW *p_convex
|
||||
if (!cinfo.result_callback && cinfo.collided)
|
||||
return; //already collided and no contacts requested, don't test anymore
|
||||
|
||||
bool collided = collision_solver(cinfo.shape_A, *cinfo.transform_A, *cinfo.transform_inv_A, p_convex,*cinfo.transform_B,*cinfo.transform_inv_B, cinfo.result_callback, cinfo.userdata, cinfo.swap_result,cinfo.sep_axis );
|
||||
bool collided = collision_solver(cinfo.shape_A, *cinfo.transform_A, cinfo.motion_A, p_convex,*cinfo.transform_B, cinfo.motion_B, cinfo.result_callback, cinfo.userdata, cinfo.swap_result,cinfo.sep_axis );
|
||||
if (!collided)
|
||||
return;
|
||||
|
||||
@@ -178,17 +179,16 @@ void CollisionSolver2DSW::concave_callback(void *p_userdata, Shape2DSW *p_convex
|
||||
|
||||
}
|
||||
|
||||
bool CollisionSolver2DSW::solve_concave(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Matrix32& p_transform_inv_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,const Matrix32& p_transform_inv_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result,Vector2 *sep_axis) {
|
||||
bool CollisionSolver2DSW::solve_concave(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Vector2& p_motion_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,const Vector2& p_motion_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result,Vector2 *sep_axis) {
|
||||
|
||||
|
||||
const ConcaveShape2DSW *concave_B=static_cast<const ConcaveShape2DSW*>(p_shape_B);
|
||||
|
||||
_ConcaveCollisionInfo2D cinfo;
|
||||
cinfo.transform_A=&p_transform_A;
|
||||
cinfo.transform_inv_A=&p_transform_inv_A;
|
||||
cinfo.shape_A=p_shape_A;
|
||||
cinfo.transform_B=&p_transform_B;
|
||||
cinfo.transform_inv_B=&p_transform_inv_B;
|
||||
cinfo.motion_A=p_motion_A;
|
||||
cinfo.result_callback=p_result_callback;
|
||||
cinfo.userdata=p_userdata;
|
||||
cinfo.swap_result=p_swap_result;
|
||||
@@ -227,7 +227,8 @@ bool CollisionSolver2DSW::solve_concave(const Shape2DSW *p_shape_A,const Matrix3
|
||||
}
|
||||
|
||||
|
||||
bool CollisionSolver2DSW::solve_static(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Matrix32& p_transform_inv_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,const Matrix32& p_transform_inv_B,CallbackResult p_result_callback,void *p_userdata,Vector2 *sep_axis) {
|
||||
bool CollisionSolver2DSW::solve(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Vector2& p_motion_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,const Vector2& p_motion_B,CallbackResult p_result_callback,void *p_userdata,Vector2 *sep_axis) {
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -253,9 +254,9 @@ bool CollisionSolver2DSW::solve_static(const Shape2DSW *p_shape_A,const Matrix32
|
||||
}
|
||||
|
||||
if (swap) {
|
||||
return solve_static_line(p_shape_B,p_transform_B,p_transform_inv_B,p_shape_A,p_transform_A,p_transform_inv_A,p_result_callback,p_userdata,true);
|
||||
return solve_static_line(p_shape_B,p_transform_B,p_shape_A,p_transform_A,p_result_callback,p_userdata,true);
|
||||
} else {
|
||||
return solve_static_line(p_shape_A,p_transform_A,p_transform_inv_A,p_shape_B,p_transform_B,p_transform_inv_B,p_result_callback,p_userdata,false);
|
||||
return solve_static_line(p_shape_A,p_transform_A,p_shape_B,p_transform_B,p_result_callback,p_userdata,false);
|
||||
}
|
||||
|
||||
/*} else if (type_A==Physics2DServer::SHAPE_RAY) {
|
||||
@@ -278,9 +279,9 @@ bool CollisionSolver2DSW::solve_static(const Shape2DSW *p_shape_A,const Matrix32
|
||||
|
||||
|
||||
if (swap) {
|
||||
return solve_raycast(p_shape_B,p_transform_B,p_transform_inv_B,p_shape_A,p_transform_A,p_transform_inv_A,p_result_callback,p_userdata,true,sep_axis);
|
||||
return solve_raycast(p_shape_B,p_transform_B,p_shape_A,p_transform_A,p_result_callback,p_userdata,true,sep_axis);
|
||||
} else {
|
||||
return solve_raycast(p_shape_A,p_transform_A,p_transform_inv_A,p_shape_B,p_transform_B,p_transform_inv_B,p_result_callback,p_userdata,false,sep_axis);
|
||||
return solve_raycast(p_shape_A,p_transform_A,p_shape_B,p_transform_B,p_result_callback,p_userdata,false,sep_axis);
|
||||
}
|
||||
|
||||
|
||||
@@ -291,16 +292,16 @@ bool CollisionSolver2DSW::solve_static(const Shape2DSW *p_shape_A,const Matrix32
|
||||
return false;
|
||||
|
||||
if (!swap)
|
||||
return solve_concave(p_shape_A,p_transform_A,p_transform_inv_A,p_shape_B,p_transform_B,p_transform_inv_B,p_result_callback,p_userdata,false,sep_axis);
|
||||
return solve_concave(p_shape_A,p_transform_A,p_motion_A,p_shape_B,p_transform_B,p_motion_B,p_result_callback,p_userdata,false,sep_axis);
|
||||
else
|
||||
return solve_concave(p_shape_B,p_transform_B,p_transform_inv_B,p_shape_A,p_transform_A,p_transform_inv_A,p_result_callback,p_userdata,true,sep_axis);
|
||||
return solve_concave(p_shape_B,p_transform_B,p_motion_B,p_shape_A,p_transform_A,p_motion_A,p_result_callback,p_userdata,true,sep_axis);
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
return collision_solver(p_shape_A, p_transform_A, p_transform_inv_A, p_shape_B, p_transform_B, p_transform_inv_B, p_result_callback,p_userdata,false,sep_axis);
|
||||
return collision_solver(p_shape_A, p_transform_A,p_motion_A, p_shape_B, p_transform_B, p_motion_B,p_result_callback,p_userdata,false,sep_axis);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,16 +35,16 @@ class CollisionSolver2DSW {
|
||||
public:
|
||||
typedef void (*CallbackResult)(const Vector2& p_point_A,const Vector2& p_point_B,void *p_userdata);
|
||||
private:
|
||||
static bool solve_static_line(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Matrix32& p_transform_inv_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,const Matrix32& p_transform_inv_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result);
|
||||
static bool solve_static_line(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result);
|
||||
static void concave_callback(void *p_userdata, Shape2DSW *p_convex);
|
||||
static bool solve_concave(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Matrix32& p_transform_inv_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,const Matrix32& p_transform_inv_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result,Vector2 *sep_axis=NULL);
|
||||
static bool solve_raycast(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Matrix32& p_transform_inv_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,const Matrix32& p_transform_inv_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result,Vector2 *sep_axis=NULL);
|
||||
static bool solve_concave(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Vector2& p_motion_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,const Vector2& p_motion_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result,Vector2 *sep_axis=NULL);
|
||||
static bool solve_raycast(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result,Vector2 *sep_axis=NULL);
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
static bool solve_static(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Matrix32& p_inverse_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,const Matrix32& p_inverse_B,CallbackResult p_result_callback,void *p_userdata,Vector2 *sep_axis=NULL);
|
||||
static bool solve(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Vector2& p_motion_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,const Vector2& p_motion_B,CallbackResult p_result_callback,void *p_userdata,Vector2 *sep_axis=NULL);
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "physics_2d_server_sw.h"
|
||||
#include "broad_phase_2d_basic.h"
|
||||
#include "broad_phase_2d_hash_grid.h"
|
||||
#include "collision_solver_2d_sw.h"
|
||||
|
||||
RID Physics2DServerSW::shape_create(ShapeType p_shape) {
|
||||
|
||||
@@ -81,6 +82,9 @@ RID Physics2DServerSW::shape_create(ShapeType p_shape) {
|
||||
return id;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
void Physics2DServerSW::shape_set_data(RID p_shape, const Variant& p_data) {
|
||||
|
||||
Shape2DSW *shape = shape_owner.get(p_shape);
|
||||
@@ -126,6 +130,63 @@ real_t Physics2DServerSW::shape_get_custom_solver_bias(RID p_shape) const {
|
||||
}
|
||||
|
||||
|
||||
void Physics2DServerSW::_shape_col_cbk(const Vector2& p_point_A,const Vector2& p_point_B,void *p_userdata) {
|
||||
|
||||
CollCbkData *cbk=(CollCbkData *)p_userdata;
|
||||
|
||||
if (cbk->amount == cbk->max) {
|
||||
//find least deep
|
||||
float min_depth=1e20;
|
||||
int min_depth_idx=0;
|
||||
for(int i=0;i<cbk->amount;i++) {
|
||||
|
||||
float d = cbk->ptr[i*2+0].distance_squared_to(cbk->ptr[i*2+1]);
|
||||
if (d<min_depth) {
|
||||
min_depth=d;
|
||||
min_depth_idx=i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
float d = p_point_A.distance_squared_to(p_point_B);
|
||||
if (d<min_depth)
|
||||
return;
|
||||
cbk->ptr[min_depth_idx*2+0]=p_point_A;
|
||||
cbk->ptr[min_depth_idx*2+1]=p_point_B;
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
cbk->ptr[cbk->amount*2+0]=p_point_A;
|
||||
cbk->ptr[cbk->amount*2+1]=p_point_B;
|
||||
}
|
||||
}
|
||||
|
||||
bool Physics2DServerSW::shape_collide(RID p_shape_A, const Matrix32& p_xform_A,const Vector2& p_motion_A,RID p_shape_B, const Matrix32& p_xform_B, const Vector2& p_motion_B,Vector2 *r_results,int p_result_max,int &r_result_count) {
|
||||
|
||||
|
||||
Shape2DSW *shape_A = shape_owner.get(p_shape_A);
|
||||
ERR_FAIL_COND_V(!shape_A,false);
|
||||
Shape2DSW *shape_B = shape_owner.get(p_shape_B);
|
||||
ERR_FAIL_COND_V(!shape_B,false);
|
||||
|
||||
if (p_result_max==0) {
|
||||
|
||||
return CollisionSolver2DSW::solve(shape_A,p_xform_A,p_motion_A,shape_B,p_xform_B,p_motion_B,NULL,NULL);
|
||||
}
|
||||
|
||||
CollCbkData cbk;
|
||||
cbk.max=p_result_max;
|
||||
cbk.amount=0;
|
||||
cbk.ptr=r_results;
|
||||
|
||||
bool res= CollisionSolver2DSW::solve(shape_A,p_xform_A,p_motion_A,shape_B,p_xform_B,p_motion_B,_shape_col_cbk,&cbk);
|
||||
r_result_count=cbk.amount;
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
RID Physics2DServerSW::space_create() {
|
||||
|
||||
Space2DSW *space = memnew( Space2DSW );
|
||||
@@ -442,7 +503,7 @@ void Physics2DServerSW::body_set_mode(RID p_body, BodyMode p_mode) {
|
||||
body->set_mode(p_mode);
|
||||
};
|
||||
|
||||
Physics2DServer::BodyMode Physics2DServerSW::body_get_mode(RID p_body, BodyMode p_mode) const {
|
||||
Physics2DServer::BodyMode Physics2DServerSW::body_get_mode(RID p_body) const {
|
||||
|
||||
Body2DSW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND_V(!body,BODY_MODE_STATIC);
|
||||
@@ -550,23 +611,25 @@ bool Physics2DServerSW::body_is_shape_set_as_trigger(RID p_body, int p_shape_idx
|
||||
}
|
||||
|
||||
|
||||
void Physics2DServerSW::body_set_enable_continuous_collision_detection(RID p_body,bool p_enable) {
|
||||
void Physics2DServerSW::body_set_continuous_collision_detection_mode(RID p_body,CCDMode p_mode) {
|
||||
|
||||
Body2DSW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
||||
body->set_continuous_collision_detection(p_enable);
|
||||
body->set_continuous_collision_detection_mode(p_mode);
|
||||
|
||||
}
|
||||
|
||||
bool Physics2DServerSW::body_is_continuous_collision_detection_enabled(RID p_body) const {
|
||||
Physics2DServerSW::CCDMode Physics2DServerSW::body_get_continuous_collision_detection_mode(RID p_body) const{
|
||||
|
||||
Body2DSW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND_V(!body,false);
|
||||
const Body2DSW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND_V(!body,CCD_MODE_DISABLED);
|
||||
|
||||
return body->get_continuous_collision_detection_mode();
|
||||
|
||||
return body->is_continuous_collision_detection_enabled();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Physics2DServerSW::body_attach_object_instance_ID(RID p_body,uint32_t p_ID) {
|
||||
|
||||
Body2DSW *body = body_owner.get(p_body);
|
||||
@@ -617,13 +680,6 @@ float Physics2DServerSW::body_get_param(RID p_body, BodyParameter p_param) const
|
||||
};
|
||||
|
||||
|
||||
void Physics2DServerSW::body_static_simulate_motion(RID p_body,const Matrix32& p_new_transform) {
|
||||
|
||||
Body2DSW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
body->simulate_motion(p_new_transform,last_step);
|
||||
|
||||
};
|
||||
|
||||
void Physics2DServerSW::body_set_state(RID p_body, BodyState p_state, const Variant& p_variant) {
|
||||
|
||||
@@ -775,6 +831,16 @@ void Physics2DServerSW::body_set_force_integration_callback(RID p_body,Object *p
|
||||
|
||||
}
|
||||
|
||||
bool Physics2DServerSW::body_collide_shape(RID p_body, int p_body_shape, RID p_shape, const Matrix32& p_shape_xform,const Vector2& p_motion,Vector2 *r_results,int p_result_max,int &r_result_count) {
|
||||
|
||||
Body2DSW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND_V(!body,false);
|
||||
ERR_FAIL_INDEX_V(p_body_shape,body->get_shape_count(),false);
|
||||
|
||||
return shape_collide(body->get_shape(p_body_shape)->get_self(),body->get_transform() * body->get_shape_transform(p_body_shape),Vector2(),p_shape,p_shape_xform,p_motion,r_results,p_result_max,r_result_count);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* JOINT API */
|
||||
|
||||
|
||||
@@ -58,6 +58,16 @@ friend class Physics2DDirectSpaceStateSW;
|
||||
mutable RID_Owner<Body2DSW> body_owner;
|
||||
mutable RID_Owner<Joint2DSW> joint_owner;
|
||||
|
||||
struct CollCbkData {
|
||||
|
||||
int max;
|
||||
int amount;
|
||||
Vector2 *ptr;
|
||||
};
|
||||
|
||||
static void _shape_col_cbk(const Vector2& p_point_A,const Vector2& p_point_B,void *p_userdata);
|
||||
|
||||
|
||||
// void _clear_query(Query2DSW *p_query);
|
||||
public:
|
||||
|
||||
@@ -69,6 +79,8 @@ public:
|
||||
virtual Variant shape_get_data(RID p_shape) const;
|
||||
virtual real_t shape_get_custom_solver_bias(RID p_shape) const;
|
||||
|
||||
virtual bool shape_collide(RID p_shape_A, const Matrix32& p_xform_A,const Vector2& p_motion_A,RID p_shape_B, const Matrix32& p_xform_B, const Vector2& p_motion_B,Vector2 *r_results,int p_result_max,int &r_result_count);
|
||||
|
||||
/* SPACE API */
|
||||
|
||||
virtual RID space_create();
|
||||
@@ -124,7 +136,7 @@ public:
|
||||
virtual RID body_get_space(RID p_body) const;
|
||||
|
||||
virtual void body_set_mode(RID p_body, BodyMode p_mode);
|
||||
virtual BodyMode body_get_mode(RID p_body, BodyMode p_mode) const;
|
||||
virtual BodyMode body_get_mode(RID p_body) const;
|
||||
|
||||
virtual void body_add_shape(RID p_body, RID p_shape, const Matrix32& p_transform=Matrix32());
|
||||
virtual void body_set_shape(RID p_body, int p_shape_idx,RID p_shape);
|
||||
@@ -143,8 +155,8 @@ public:
|
||||
virtual void body_attach_object_instance_ID(RID p_body,uint32_t p_ID);
|
||||
virtual uint32_t body_get_object_instance_ID(RID p_body) const;
|
||||
|
||||
virtual void body_set_enable_continuous_collision_detection(RID p_body,bool p_enable);
|
||||
virtual bool body_is_continuous_collision_detection_enabled(RID p_body) const;
|
||||
virtual void body_set_continuous_collision_detection_mode(RID p_body,CCDMode p_mode);
|
||||
virtual CCDMode body_get_continuous_collision_detection_mode(RID p_body) const;
|
||||
|
||||
virtual void body_set_user_flags(RID p_body, uint32_t p_flags);
|
||||
virtual uint32_t body_get_user_flags(RID p_body, uint32_t p_flags) const;
|
||||
@@ -152,8 +164,6 @@ public:
|
||||
virtual void body_set_param(RID p_body, BodyParameter p_param, float p_value);
|
||||
virtual float body_get_param(RID p_body, BodyParameter p_param) const;
|
||||
|
||||
//advanced simulation
|
||||
virtual void body_static_simulate_motion(RID p_body,const Matrix32& p_new_transform);
|
||||
|
||||
virtual void body_set_state(RID p_body, BodyState p_state, const Variant& p_variant);
|
||||
virtual Variant body_get_state(RID p_body, BodyState p_state) const;
|
||||
@@ -181,6 +191,7 @@ public:
|
||||
virtual int body_get_max_contacts_reported(RID p_body) const;
|
||||
|
||||
virtual void body_set_force_integration_callback(RID p_body,Object *p_receiver,const StringName& p_method,const Variant& p_udata=Variant());
|
||||
virtual bool body_collide_shape(RID p_body, int p_body_shape,RID p_shape, const Matrix32& p_shape_xform,const Vector2& p_motion,Vector2 *r_results,int p_result_max,int &r_result_count);
|
||||
|
||||
/* JOINT API */
|
||||
|
||||
|
||||
+1056
-1057
File diff suppressed because it is too large
Load Diff
+513
-414
File diff suppressed because it is too large
Load Diff
+594
-404
File diff suppressed because it is too large
Load Diff
+133
-132
@@ -26,135 +26,136 @@
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef SPACE_2D_SW_H
|
||||
#define SPACE_2D_SW_H
|
||||
|
||||
#include "typedefs.h"
|
||||
#include "hash_map.h"
|
||||
#include "body_2d_sw.h"
|
||||
#include "area_2d_sw.h"
|
||||
#include "body_pair_2d_sw.h"
|
||||
#include "area_pair_2d_sw.h"
|
||||
#include "broad_phase_2d_sw.h"
|
||||
#include "collision_object_2d_sw.h"
|
||||
|
||||
|
||||
class Physics2DDirectSpaceStateSW : public Physics2DDirectSpaceState {
|
||||
|
||||
OBJ_TYPE( Physics2DDirectSpaceStateSW, Physics2DDirectSpaceState );
|
||||
public:
|
||||
|
||||
Space2DSW *space;
|
||||
|
||||
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);
|
||||
int intersect_shape(const RID& p_shape, const Matrix32& p_xform,ShapeResult *r_results,int p_result_max,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_user_mask=0);
|
||||
|
||||
Physics2DDirectSpaceStateSW();
|
||||
};
|
||||
|
||||
|
||||
|
||||
class Space2DSW {
|
||||
|
||||
|
||||
Physics2DDirectSpaceStateSW *direct_access;
|
||||
RID self;
|
||||
|
||||
BroadPhase2DSW *broadphase;
|
||||
SelfList<Body2DSW>::List active_list;
|
||||
SelfList<Body2DSW>::List inertia_update_list;
|
||||
SelfList<Body2DSW>::List state_query_list;
|
||||
SelfList<Area2DSW>::List monitor_query_list;
|
||||
SelfList<Area2DSW>::List area_moved_list;
|
||||
|
||||
static void* _broadphase_pair(CollisionObject2DSW *A,int p_subindex_A,CollisionObject2DSW *B,int p_subindex_B,void *p_self);
|
||||
static void _broadphase_unpair(CollisionObject2DSW *A,int p_subindex_A,CollisionObject2DSW *B,int p_subindex_B,void *p_data,void *p_self);
|
||||
|
||||
Set<CollisionObject2DSW*> objects;
|
||||
|
||||
Area2DSW *area;
|
||||
|
||||
real_t contact_recycle_radius;
|
||||
real_t contact_max_separation;
|
||||
real_t contact_max_allowed_penetration;
|
||||
real_t constraint_bias;
|
||||
|
||||
enum {
|
||||
|
||||
INTERSECTION_QUERY_MAX=2048
|
||||
};
|
||||
|
||||
CollisionObject2DSW *intersection_query_results[INTERSECTION_QUERY_MAX];
|
||||
int intersection_query_subindex_results[INTERSECTION_QUERY_MAX];
|
||||
|
||||
float body_linear_velocity_sleep_treshold;
|
||||
float body_angular_velocity_sleep_treshold;
|
||||
float body_time_to_sleep;
|
||||
float body_angular_velocity_damp_ratio;
|
||||
|
||||
bool locked;
|
||||
|
||||
friend class Physics2DDirectSpaceStateSW;
|
||||
|
||||
public:
|
||||
|
||||
_FORCE_INLINE_ void set_self(const RID& p_self) { self=p_self; }
|
||||
_FORCE_INLINE_ RID get_self() const { return self; }
|
||||
|
||||
void set_default_area(Area2DSW *p_area) { area=p_area; }
|
||||
Area2DSW *get_default_area() const { return area; }
|
||||
|
||||
const SelfList<Body2DSW>::List& get_active_body_list() const;
|
||||
void body_add_to_active_list(SelfList<Body2DSW>* p_body);
|
||||
void body_remove_from_active_list(SelfList<Body2DSW>* p_body);
|
||||
void body_add_to_inertia_update_list(SelfList<Body2DSW>* p_body);
|
||||
void body_remove_from_inertia_update_list(SelfList<Body2DSW>* p_body);
|
||||
void area_add_to_moved_list(SelfList<Area2DSW>* p_area);
|
||||
void area_remove_from_moved_list(SelfList<Area2DSW>* p_area);
|
||||
const SelfList<Area2DSW>::List& get_moved_area_list() const;
|
||||
|
||||
|
||||
|
||||
|
||||
void body_add_to_state_query_list(SelfList<Body2DSW>* p_body);
|
||||
void body_remove_from_state_query_list(SelfList<Body2DSW>* p_body);
|
||||
|
||||
void area_add_to_monitor_query_list(SelfList<Area2DSW>* p_area);
|
||||
void area_remove_from_monitor_query_list(SelfList<Area2DSW>* p_area);
|
||||
|
||||
BroadPhase2DSW *get_broadphase();
|
||||
|
||||
void add_object(CollisionObject2DSW *p_object);
|
||||
void remove_object(CollisionObject2DSW *p_object);
|
||||
const Set<CollisionObject2DSW*> &get_objects() const;
|
||||
|
||||
_FORCE_INLINE_ real_t get_contact_recycle_radius() const { return contact_recycle_radius; }
|
||||
_FORCE_INLINE_ real_t get_contact_max_separation() const { return contact_max_separation; }
|
||||
_FORCE_INLINE_ real_t get_contact_max_allowed_penetration() const { return contact_max_allowed_penetration; }
|
||||
_FORCE_INLINE_ real_t get_constraint_bias() const { return constraint_bias; }
|
||||
_FORCE_INLINE_ real_t get_body_linear_velocity_sleep_treshold() const { return body_linear_velocity_sleep_treshold; }
|
||||
_FORCE_INLINE_ real_t get_body_angular_velocity_sleep_treshold() const { return body_angular_velocity_sleep_treshold; }
|
||||
_FORCE_INLINE_ real_t get_body_time_to_sleep() const { return body_time_to_sleep; }
|
||||
_FORCE_INLINE_ real_t get_body_angular_velocity_damp_ratio() const { return body_angular_velocity_damp_ratio; }
|
||||
|
||||
|
||||
void update();
|
||||
void setup();
|
||||
void call_queries();
|
||||
|
||||
|
||||
bool is_locked() const;
|
||||
void lock();
|
||||
void unlock();
|
||||
|
||||
void set_param(Physics2DServer::SpaceParameter p_param, real_t p_value);
|
||||
real_t get_param(Physics2DServer::SpaceParameter p_param) const;
|
||||
|
||||
Physics2DDirectSpaceStateSW *get_direct_state();
|
||||
|
||||
Space2DSW();
|
||||
~Space2DSW();
|
||||
};
|
||||
|
||||
|
||||
#endif // SPACE_2D_SW_H
|
||||
#ifndef SPACE_2D_SW_H
|
||||
#define SPACE_2D_SW_H
|
||||
|
||||
#include "typedefs.h"
|
||||
#include "hash_map.h"
|
||||
#include "body_2d_sw.h"
|
||||
#include "area_2d_sw.h"
|
||||
#include "body_pair_2d_sw.h"
|
||||
#include "area_pair_2d_sw.h"
|
||||
#include "broad_phase_2d_sw.h"
|
||||
#include "collision_object_2d_sw.h"
|
||||
|
||||
|
||||
class Physics2DDirectSpaceStateSW : public Physics2DDirectSpaceState {
|
||||
|
||||
OBJ_TYPE( Physics2DDirectSpaceStateSW, Physics2DDirectSpaceState );
|
||||
public:
|
||||
|
||||
Space2DSW *space;
|
||||
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
|
||||
Physics2DDirectSpaceStateSW();
|
||||
};
|
||||
|
||||
|
||||
|
||||
class Space2DSW {
|
||||
|
||||
|
||||
Physics2DDirectSpaceStateSW *direct_access;
|
||||
RID self;
|
||||
|
||||
BroadPhase2DSW *broadphase;
|
||||
SelfList<Body2DSW>::List active_list;
|
||||
SelfList<Body2DSW>::List inertia_update_list;
|
||||
SelfList<Body2DSW>::List state_query_list;
|
||||
SelfList<Area2DSW>::List monitor_query_list;
|
||||
SelfList<Area2DSW>::List area_moved_list;
|
||||
|
||||
static void* _broadphase_pair(CollisionObject2DSW *A,int p_subindex_A,CollisionObject2DSW *B,int p_subindex_B,void *p_self);
|
||||
static void _broadphase_unpair(CollisionObject2DSW *A,int p_subindex_A,CollisionObject2DSW *B,int p_subindex_B,void *p_data,void *p_self);
|
||||
|
||||
Set<CollisionObject2DSW*> objects;
|
||||
|
||||
Area2DSW *area;
|
||||
|
||||
real_t contact_recycle_radius;
|
||||
real_t contact_max_separation;
|
||||
real_t contact_max_allowed_penetration;
|
||||
real_t constraint_bias;
|
||||
|
||||
enum {
|
||||
|
||||
INTERSECTION_QUERY_MAX=2048
|
||||
};
|
||||
|
||||
CollisionObject2DSW *intersection_query_results[INTERSECTION_QUERY_MAX];
|
||||
int intersection_query_subindex_results[INTERSECTION_QUERY_MAX];
|
||||
|
||||
float body_linear_velocity_sleep_treshold;
|
||||
float body_angular_velocity_sleep_treshold;
|
||||
float body_time_to_sleep;
|
||||
float body_angular_velocity_damp_ratio;
|
||||
|
||||
bool locked;
|
||||
|
||||
friend class Physics2DDirectSpaceStateSW;
|
||||
|
||||
public:
|
||||
|
||||
_FORCE_INLINE_ void set_self(const RID& p_self) { self=p_self; }
|
||||
_FORCE_INLINE_ RID get_self() const { return self; }
|
||||
|
||||
void set_default_area(Area2DSW *p_area) { area=p_area; }
|
||||
Area2DSW *get_default_area() const { return area; }
|
||||
|
||||
const SelfList<Body2DSW>::List& get_active_body_list() const;
|
||||
void body_add_to_active_list(SelfList<Body2DSW>* p_body);
|
||||
void body_remove_from_active_list(SelfList<Body2DSW>* p_body);
|
||||
void body_add_to_inertia_update_list(SelfList<Body2DSW>* p_body);
|
||||
void body_remove_from_inertia_update_list(SelfList<Body2DSW>* p_body);
|
||||
void area_add_to_moved_list(SelfList<Area2DSW>* p_area);
|
||||
void area_remove_from_moved_list(SelfList<Area2DSW>* p_area);
|
||||
const SelfList<Area2DSW>::List& get_moved_area_list() const;
|
||||
|
||||
|
||||
|
||||
|
||||
void body_add_to_state_query_list(SelfList<Body2DSW>* p_body);
|
||||
void body_remove_from_state_query_list(SelfList<Body2DSW>* p_body);
|
||||
|
||||
void area_add_to_monitor_query_list(SelfList<Area2DSW>* p_area);
|
||||
void area_remove_from_monitor_query_list(SelfList<Area2DSW>* p_area);
|
||||
|
||||
BroadPhase2DSW *get_broadphase();
|
||||
|
||||
void add_object(CollisionObject2DSW *p_object);
|
||||
void remove_object(CollisionObject2DSW *p_object);
|
||||
const Set<CollisionObject2DSW*> &get_objects() const;
|
||||
|
||||
_FORCE_INLINE_ real_t get_contact_recycle_radius() const { return contact_recycle_radius; }
|
||||
_FORCE_INLINE_ real_t get_contact_max_separation() const { return contact_max_separation; }
|
||||
_FORCE_INLINE_ real_t get_contact_max_allowed_penetration() const { return contact_max_allowed_penetration; }
|
||||
_FORCE_INLINE_ real_t get_constraint_bias() const { return constraint_bias; }
|
||||
_FORCE_INLINE_ real_t get_body_linear_velocity_sleep_treshold() const { return body_linear_velocity_sleep_treshold; }
|
||||
_FORCE_INLINE_ real_t get_body_angular_velocity_sleep_treshold() const { return body_angular_velocity_sleep_treshold; }
|
||||
_FORCE_INLINE_ real_t get_body_time_to_sleep() const { return body_time_to_sleep; }
|
||||
_FORCE_INLINE_ real_t get_body_angular_velocity_damp_ratio() const { return body_angular_velocity_damp_ratio; }
|
||||
|
||||
|
||||
void update();
|
||||
void setup();
|
||||
void call_queries();
|
||||
|
||||
|
||||
bool is_locked() const;
|
||||
void lock();
|
||||
void unlock();
|
||||
|
||||
void set_param(Physics2DServer::SpaceParameter p_param, real_t p_value);
|
||||
real_t get_param(Physics2DServer::SpaceParameter p_param) const;
|
||||
|
||||
Physics2DDirectSpaceStateSW *get_direct_state();
|
||||
|
||||
Space2DSW();
|
||||
~Space2DSW();
|
||||
};
|
||||
|
||||
|
||||
#endif // SPACE_2D_SW_H
|
||||
|
||||
@@ -49,7 +49,7 @@ void Step2DSW::_populate_island(Body2DSW* p_body,Body2DSW** p_island,Constraint2
|
||||
if (i==E->get())
|
||||
continue;
|
||||
Body2DSW *b = c->get_body_ptr()[i];
|
||||
if (b->get_island_step()==_step || b->get_mode()==Physics2DServer::BODY_MODE_STATIC)
|
||||
if (b->get_island_step()==_step || b->get_mode()==Physics2DServer::BODY_MODE_STATIC || b->get_mode()==Physics2DServer::BODY_MODE_KINEMATIC)
|
||||
continue; //no go
|
||||
_populate_island(c->get_body_ptr()[i],p_island,p_constraint_island);
|
||||
}
|
||||
@@ -87,8 +87,10 @@ void Step2DSW::_check_suspend(Body2DSW *p_island,float p_delta) {
|
||||
Body2DSW *b = p_island;
|
||||
while(b) {
|
||||
|
||||
if (b->get_mode()==Physics2DServer::BODY_MODE_STATIC)
|
||||
if (b->get_mode()==Physics2DServer::BODY_MODE_STATIC || b->get_mode()==Physics2DServer::BODY_MODE_KINEMATIC) {
|
||||
b=b->get_island_next();
|
||||
continue; //ignore for static
|
||||
}
|
||||
|
||||
if (!b->sleep_test(p_delta))
|
||||
can_sleep=false;
|
||||
@@ -101,8 +103,10 @@ void Step2DSW::_check_suspend(Body2DSW *p_island,float p_delta) {
|
||||
b = p_island;
|
||||
while(b) {
|
||||
|
||||
if (b->get_mode()==Physics2DServer::BODY_MODE_STATIC)
|
||||
if (b->get_mode()==Physics2DServer::BODY_MODE_STATIC || b->get_mode()==Physics2DServer::BODY_MODE_KINEMATIC) {
|
||||
b=b->get_island_next();
|
||||
continue; //ignore for static
|
||||
}
|
||||
|
||||
bool active = b->is_active();
|
||||
|
||||
@@ -210,8 +214,9 @@ void Step2DSW::step(Space2DSW* p_space,float p_delta,int p_iterations) {
|
||||
b = body_list->first();
|
||||
while(b) {
|
||||
|
||||
const SelfList<Body2DSW>*n=b->next();
|
||||
b->self()->integrate_velocities(p_delta);
|
||||
b=b->next();
|
||||
b=n; // in case it shuts itself down
|
||||
}
|
||||
|
||||
/* SLEEP / WAKE UP ISLANDS */
|
||||
|
||||
@@ -122,7 +122,7 @@ Variant Physics2DDirectSpaceState::_intersect_ray(const Vector2& p_from, const V
|
||||
if (!res)
|
||||
return Variant();
|
||||
|
||||
Dictionary d;
|
||||
Dictionary d(true);
|
||||
d["position"]=inters.position;
|
||||
d["normal"]=inters.normal;
|
||||
d["collider_id"]=inters.collider_id;
|
||||
@@ -145,7 +145,7 @@ Variant Physics2DDirectSpaceState::_intersect_shape(const RID& p_shape, const Ma
|
||||
|
||||
ShapeResult *res=(ShapeResult*)alloca(p_result_max*sizeof(ShapeResult));
|
||||
|
||||
int rc = intersect_shape(p_shape,p_xform,res,p_result_max,exclude,p_user_mask);
|
||||
int rc = intersect_shape(p_shape,p_xform,Vector2(),res,p_result_max,exclude,p_user_mask);
|
||||
|
||||
if (rc==0)
|
||||
return Variant();
|
||||
@@ -160,6 +160,34 @@ Variant Physics2DDirectSpaceState::_intersect_shape(const RID& p_shape, const Ma
|
||||
}
|
||||
|
||||
|
||||
Variant Physics2DDirectSpaceState::_cast_motion(const RID& p_shape, const Matrix32& p_xform,const Vector2& p_motion,const Vector<RID>& p_exclude,uint32_t p_user_mask) {
|
||||
|
||||
|
||||
Set<RID> exclude;
|
||||
for(int i=0;i<p_exclude.size();i++)
|
||||
exclude.insert(p_exclude[i]);
|
||||
|
||||
|
||||
|
||||
MotionCastCollision mcc;
|
||||
|
||||
bool result = cast_motion(p_shape,p_xform,p_motion,mcc,exclude,p_user_mask);
|
||||
|
||||
if (!result)
|
||||
return Variant();
|
||||
|
||||
Dictionary d(true);
|
||||
d["point"]=mcc.point;
|
||||
d["normal"]=mcc.normal;
|
||||
d["rid"]=mcc.rid;
|
||||
d["collider_id"]=mcc.collider_id;
|
||||
d["collider"]=mcc.collider;
|
||||
d["shape"]=mcc.shape;
|
||||
|
||||
return d;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -175,6 +203,7 @@ void Physics2DDirectSpaceState::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("intersect_ray:Dictionary","from","to","exclude","umask"),&Physics2DDirectSpaceState::_intersect_ray,DEFVAL(Array()),DEFVAL(0));
|
||||
ObjectTypeDB::bind_method(_MD("intersect_shape:Physics2DShapeQueryResult","shape","xform","result_max","exclude","umask"),&Physics2DDirectSpaceState::_intersect_shape,DEFVAL(Array()),DEFVAL(0));
|
||||
ObjectTypeDB::bind_method(_MD("cast_motion","shape","xform","motion","exclude","umask"),&Physics2DDirectSpaceState::_intersect_shape,DEFVAL(Array()),DEFVAL(0));
|
||||
|
||||
}
|
||||
|
||||
@@ -297,8 +326,8 @@ void Physics2DServer::_bind_methods() {
|
||||
ObjectTypeDB::bind_method(_MD("body_get_object_instance_ID","body"),&Physics2DServer::body_get_object_instance_ID);
|
||||
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("body_set_enable_continuous_collision_detection","body","enable"),&Physics2DServer::body_set_enable_continuous_collision_detection);
|
||||
ObjectTypeDB::bind_method(_MD("body_is_continuous_collision_detection_enabled","body"),&Physics2DServer::body_is_continuous_collision_detection_enabled);
|
||||
ObjectTypeDB::bind_method(_MD("body_set_continuous_collision_detection_mode","body","mode"),&Physics2DServer::body_set_continuous_collision_detection_mode);
|
||||
ObjectTypeDB::bind_method(_MD("body_get_continuous_collision_detection_mode","body"),&Physics2DServer::body_get_continuous_collision_detection_mode);
|
||||
|
||||
|
||||
//ObjectTypeDB::bind_method(_MD("body_set_user_flags","flags""),&Physics2DServer::body_set_shape,DEFVAL(Matrix32));
|
||||
@@ -307,8 +336,6 @@ void Physics2DServer::_bind_methods() {
|
||||
ObjectTypeDB::bind_method(_MD("body_set_param","body","param","value"),&Physics2DServer::body_set_param);
|
||||
ObjectTypeDB::bind_method(_MD("body_get_param","body","param"),&Physics2DServer::body_get_param);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("body_static_simulate_motion","body","new_xform"),&Physics2DServer::body_static_simulate_motion);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("body_set_state","body","state","value"),&Physics2DServer::body_set_state);
|
||||
ObjectTypeDB::bind_method(_MD("body_get_state","body","state"),&Physics2DServer::body_get_state);
|
||||
|
||||
@@ -371,7 +398,7 @@ void Physics2DServer::_bind_methods() {
|
||||
BIND_CONSTANT( AREA_SPACE_OVERRIDE_REPLACE );
|
||||
|
||||
BIND_CONSTANT( BODY_MODE_STATIC );
|
||||
BIND_CONSTANT( BODY_MODE_STATIC_ACTIVE );
|
||||
BIND_CONSTANT( BODY_MODE_KINEMATIC );
|
||||
BIND_CONSTANT( BODY_MODE_RIGID );
|
||||
BIND_CONSTANT( BODY_MODE_CHARACTER );
|
||||
|
||||
@@ -394,6 +421,10 @@ void Physics2DServer::_bind_methods() {
|
||||
BIND_CONSTANT( DAMPED_STRING_STIFFNESS );
|
||||
BIND_CONSTANT( DAMPED_STRING_DAMPING );
|
||||
|
||||
BIND_CONSTANT( CCD_MODE_DISABLED );
|
||||
BIND_CONSTANT( CCD_MODE_CAST_RAY );
|
||||
BIND_CONSTANT( CCD_MODE_CAST_SHAPE );
|
||||
|
||||
// BIND_CONSTANT( TYPE_BODY );
|
||||
// BIND_CONSTANT( TYPE_AREA );
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ class Physics2DDirectSpaceState : public Object {
|
||||
|
||||
Variant _intersect_ray(const Vector2& p_from, const Vector2& p_to,const Vector<RID>& p_exclude=Vector<RID>(),uint32_t p_user_mask=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_user_mask=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_user_mask=0);
|
||||
|
||||
|
||||
protected:
|
||||
@@ -118,7 +119,26 @@ public:
|
||||
|
||||
};
|
||||
|
||||
virtual int intersect_shape(const RID& p_shape, const Matrix32& p_xform,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,ShapeResult *r_results,int p_result_max,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_user_mask=0)=0;
|
||||
|
||||
|
||||
|
||||
struct MotionCastCollision {
|
||||
|
||||
float travel; //0 to 1, if 0 then it's blocked
|
||||
Vector2 point;
|
||||
Vector2 normal;
|
||||
RID rid;
|
||||
ObjectID collider_id;
|
||||
Object *collider;
|
||||
int shape;
|
||||
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
|
||||
|
||||
|
||||
Physics2DDirectSpaceState();
|
||||
};
|
||||
@@ -179,6 +199,8 @@ public:
|
||||
virtual Variant shape_get_data(RID p_shape) const=0;
|
||||
virtual real_t shape_get_custom_solver_bias(RID p_shape) const=0;
|
||||
|
||||
//these work well, but should be used from the main thread only
|
||||
virtual bool shape_collide(RID p_shape_A, const Matrix32& p_xform_A,const Vector2& p_motion_A,RID p_shape_B, const Matrix32& p_xform_B, const Vector2& p_motion_B,Vector2 *r_results,int p_result_max,int &r_result_count)=0;
|
||||
|
||||
/* SPACE API */
|
||||
|
||||
@@ -265,10 +287,10 @@ public:
|
||||
|
||||
enum BodyMode {
|
||||
BODY_MODE_STATIC,
|
||||
BODY_MODE_STATIC_ACTIVE,
|
||||
BODY_MODE_KINEMATIC,
|
||||
BODY_MODE_RIGID,
|
||||
//BODY_MODE_SOFT
|
||||
BODY_MODE_CHARACTER
|
||||
//BODY_MODE_SOFT ??
|
||||
};
|
||||
|
||||
virtual RID body_create(BodyMode p_mode=BODY_MODE_RIGID,bool p_init_sleeping=false)=0;
|
||||
@@ -277,7 +299,7 @@ public:
|
||||
virtual RID body_get_space(RID p_body) const=0;
|
||||
|
||||
virtual void body_set_mode(RID p_body, BodyMode p_mode)=0;
|
||||
virtual BodyMode body_get_mode(RID p_body, BodyMode p_mode) const=0;
|
||||
virtual BodyMode body_get_mode(RID p_body) const=0;
|
||||
|
||||
virtual void body_add_shape(RID p_body, RID p_shape, const Matrix32& p_transform=Matrix32())=0;
|
||||
virtual void body_set_shape(RID p_body, int p_shape_idx,RID p_shape)=0;
|
||||
@@ -296,8 +318,14 @@ public:
|
||||
virtual void body_attach_object_instance_ID(RID p_body,uint32_t p_ID)=0;
|
||||
virtual uint32_t body_get_object_instance_ID(RID p_body) const=0;
|
||||
|
||||
virtual void body_set_enable_continuous_collision_detection(RID p_body,bool p_enable)=0;
|
||||
virtual bool body_is_continuous_collision_detection_enabled(RID p_body) const=0;
|
||||
enum CCDMode {
|
||||
CCD_MODE_DISABLED,
|
||||
CCD_MODE_CAST_RAY,
|
||||
CCD_MODE_CAST_SHAPE,
|
||||
};
|
||||
|
||||
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;
|
||||
@@ -313,8 +341,6 @@ public:
|
||||
virtual void body_set_param(RID p_body, BodyParameter p_param, float p_value)=0;
|
||||
virtual float body_get_param(RID p_body, BodyParameter p_param) const=0;
|
||||
|
||||
//advanced simulation
|
||||
virtual void body_static_simulate_motion(RID p_body,const Matrix32& p_new_transform)=0;
|
||||
|
||||
//state
|
||||
enum BodyState {
|
||||
@@ -355,6 +381,8 @@ public:
|
||||
|
||||
virtual void body_set_force_integration_callback(RID p_body,Object *p_receiver,const StringName& p_method,const Variant& p_udata=Variant())=0;
|
||||
|
||||
virtual bool body_collide_shape(RID p_body, int p_body_shape,RID p_shape, const Matrix32& p_shape_xform,const Vector2& p_motion,Vector2 *r_results,int p_result_max,int &r_result_count)=0;
|
||||
|
||||
/* JOINT API */
|
||||
|
||||
enum JointType {
|
||||
@@ -417,6 +445,7 @@ VARIANT_ENUM_CAST( Physics2DServer::AreaSpaceOverrideMode );
|
||||
VARIANT_ENUM_CAST( Physics2DServer::BodyMode );
|
||||
VARIANT_ENUM_CAST( Physics2DServer::BodyParameter );
|
||||
VARIANT_ENUM_CAST( Physics2DServer::BodyState );
|
||||
VARIANT_ENUM_CAST( Physics2DServer::CCDMode );
|
||||
VARIANT_ENUM_CAST( Physics2DServer::JointParam );
|
||||
VARIANT_ENUM_CAST( Physics2DServer::JointType );
|
||||
VARIANT_ENUM_CAST( Physics2DServer::DampedStringParam );
|
||||
|
||||
@@ -374,7 +374,7 @@ void PhysicsServer::_bind_methods() {
|
||||
BIND_CONSTANT( AREA_SPACE_OVERRIDE_REPLACE );
|
||||
|
||||
BIND_CONSTANT( BODY_MODE_STATIC );
|
||||
BIND_CONSTANT( BODY_MODE_STATIC_ACTIVE );
|
||||
BIND_CONSTANT( BODY_MODE_KINEMATIC );
|
||||
BIND_CONSTANT( BODY_MODE_RIGID );
|
||||
BIND_CONSTANT( BODY_MODE_CHARACTER );
|
||||
|
||||
|
||||
@@ -268,7 +268,7 @@ public:
|
||||
|
||||
enum BodyMode {
|
||||
BODY_MODE_STATIC,
|
||||
BODY_MODE_STATIC_ACTIVE,
|
||||
BODY_MODE_KINEMATIC,
|
||||
BODY_MODE_RIGID,
|
||||
//BODY_MODE_SOFT
|
||||
BODY_MODE_CHARACTER
|
||||
|
||||
+63927
-63777
File diff suppressed because it is too large
Load Diff
@@ -150,6 +150,11 @@ void EditorImportTextureOptions::_notification(int p_what) {
|
||||
}
|
||||
}
|
||||
|
||||
void EditorImportTextureOptions::show_2d_notice() {
|
||||
|
||||
notice_for_2d->show();
|
||||
}
|
||||
|
||||
EditorImportTextureOptions::EditorImportTextureOptions() {
|
||||
|
||||
|
||||
@@ -206,6 +211,14 @@ EditorImportTextureOptions::EditorImportTextureOptions() {
|
||||
|
||||
|
||||
add_margin_child("Texture Options",flags,true);
|
||||
|
||||
notice_for_2d = memnew( Label );
|
||||
notice_for_2d->set_text("NOTICE: You are not forced to import textures for 2D projects. Just copy your .jpg or .png files to your project, and change export options later. Atlases can be generated on export too.");
|
||||
notice_for_2d->set_custom_minimum_size(Size2(0,50));
|
||||
notice_for_2d->set_autowrap(true);
|
||||
add_child(notice_for_2d);
|
||||
notice_for_2d->hide();
|
||||
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@@ -530,6 +543,7 @@ EditorTextureImportDialog::EditorTextureImportDialog(EditorTextureImportPlugin*
|
||||
texture_options->set_flags(EditorTextureImportPlugin::IMAGE_FLAG_FIX_BORDER_ALPHA|EditorTextureImportPlugin::IMAGE_FLAG_NO_MIPMAPS|EditorTextureImportPlugin::IMAGE_FLAG_FILTER);
|
||||
texture_options->set_quality(0.7);
|
||||
texture_options->set_format(EditorTextureImportPlugin::IMAGE_FORMAT_COMPRESS_DISK_LOSSY);
|
||||
texture_options->show_2d_notice();
|
||||
set_title("Import Textures for Atlas (2D)");
|
||||
|
||||
} else if (p_2d) {
|
||||
@@ -537,6 +551,7 @@ EditorTextureImportDialog::EditorTextureImportDialog(EditorTextureImportPlugin*
|
||||
texture_options->set_flags(EditorTextureImportPlugin::IMAGE_FLAG_NO_MIPMAPS|EditorTextureImportPlugin::IMAGE_FLAG_FIX_BORDER_ALPHA|EditorTextureImportPlugin::IMAGE_FLAG_FILTER);
|
||||
texture_options->set_quality(0.7);
|
||||
texture_options->set_format(EditorTextureImportPlugin::IMAGE_FORMAT_COMPRESS_DISK_LOSSY);
|
||||
texture_options->show_2d_notice();
|
||||
set_title("Import Textures for 2D");
|
||||
} else {
|
||||
|
||||
|
||||
@@ -116,6 +116,7 @@ class EditorImportTextureOptions : public VBoxContainer {
|
||||
HSlider *quality;
|
||||
Tree *flags;
|
||||
Vector<TreeItem*> items;
|
||||
Label *notice_for_2d;
|
||||
|
||||
bool updating;
|
||||
|
||||
@@ -140,6 +141,8 @@ public:
|
||||
void set_quality(float p_quality);
|
||||
float get_quality() const;
|
||||
|
||||
void show_2d_notice();
|
||||
|
||||
EditorImportTextureOptions();
|
||||
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ void TileSetEditor::_import_scene(Node *scene, Ref<TileSet> p_library, bool p_me
|
||||
|
||||
p_library->tile_set_texture(id,texture);
|
||||
if (mi->is_centered()) {
|
||||
p_library->tile_set_offset(id,texture->get_size()/2);
|
||||
p_library->tile_set_texture_offset(id,texture->get_size()/2);
|
||||
}
|
||||
if (mi->is_region()) {
|
||||
p_library->tile_set_region(id,mi->get_region_rect());
|
||||
|
||||
Reference in New Issue
Block a user