diff options
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/shape_3d.cpp | 13 | ||||
-rw-r--r-- | scene/resources/shape_3d.h | 4 |
2 files changed, 17 insertions, 0 deletions
diff --git a/scene/resources/shape_3d.cpp b/scene/resources/shape_3d.cpp index a02a0e5488..044268864a 100644 --- a/scene/resources/shape_3d.cpp +++ b/scene/resources/shape_3d.cpp @@ -48,6 +48,15 @@ void Shape3D::add_vertices_to_array(Vector<Vector3> &array, const Transform3D &p } } +void Shape3D::set_custom_solver_bias(real_t p_bias) { + custom_bias = p_bias; + PhysicsServer3D::get_singleton()->shape_set_custom_solver_bias(shape, custom_bias); +} + +real_t Shape3D::get_custom_solver_bias() const { + return custom_bias; +} + real_t Shape3D::get_margin() const { return margin; } @@ -99,11 +108,15 @@ void Shape3D::_update_shape() { } void Shape3D::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_custom_solver_bias", "bias"), &Shape3D::set_custom_solver_bias); + ClassDB::bind_method(D_METHOD("get_custom_solver_bias"), &Shape3D::get_custom_solver_bias); + ClassDB::bind_method(D_METHOD("set_margin", "margin"), &Shape3D::set_margin); ClassDB::bind_method(D_METHOD("get_margin"), &Shape3D::get_margin); ClassDB::bind_method(D_METHOD("get_debug_mesh"), &Shape3D::get_debug_mesh); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "custom_solver_bias", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_custom_solver_bias", "get_custom_solver_bias"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "margin", PROPERTY_HINT_RANGE, "0.001,10,0.001"), "set_margin", "get_margin"); } diff --git a/scene/resources/shape_3d.h b/scene/resources/shape_3d.h index b8e529cd3c..f3a7aa5b12 100644 --- a/scene/resources/shape_3d.h +++ b/scene/resources/shape_3d.h @@ -40,6 +40,7 @@ class Shape3D : public Resource { OBJ_SAVE_TYPE(Shape3D); RES_BASE_EXTENSION("shape"); RID shape; + real_t custom_bias = 0.0; real_t margin = 0.04; Ref<ArrayMesh> debug_mesh_cache; @@ -62,6 +63,9 @@ public: void add_vertices_to_array(Vector<Vector3> &array, const Transform3D &p_xform); + void set_custom_solver_bias(real_t p_bias); + real_t get_custom_solver_bias() const; + real_t get_margin() const; void set_margin(real_t p_margin); |