This commit is contained in:
Spartan322
2025-01-04 00:55:26 -05:00
376 changed files with 3848 additions and 2763 deletions

View File

@@ -331,7 +331,7 @@ void PhysicsShapeQueryParameters2D::_bind_methods() {
///////////////////////////////////////////////////////
Dictionary PhysicsDirectSpaceState2D::_intersect_ray(const Ref<PhysicsRayQueryParameters2D> &p_ray_query) {
ERR_FAIL_COND_V(!p_ray_query.is_valid(), Dictionary());
ERR_FAIL_COND_V(p_ray_query.is_null(), Dictionary());
RayResult result;
bool res = intersect_ray(p_ray_query->get_parameters(), result);
@@ -377,7 +377,7 @@ TypedArray<Dictionary> PhysicsDirectSpaceState2D::_intersect_point(const Ref<Phy
}
TypedArray<Dictionary> PhysicsDirectSpaceState2D::_intersect_shape(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query, int p_max_results) {
ERR_FAIL_COND_V(!p_shape_query.is_valid(), TypedArray<Dictionary>());
ERR_FAIL_COND_V(p_shape_query.is_null(), TypedArray<Dictionary>());
Vector<ShapeResult> sr;
sr.resize(p_max_results);
@@ -397,7 +397,7 @@ TypedArray<Dictionary> PhysicsDirectSpaceState2D::_intersect_shape(const Ref<Phy
}
Vector<real_t> PhysicsDirectSpaceState2D::_cast_motion(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query) {
ERR_FAIL_COND_V(!p_shape_query.is_valid(), Vector<real_t>());
ERR_FAIL_COND_V(p_shape_query.is_null(), Vector<real_t>());
real_t closest_safe, closest_unsafe;
bool res = cast_motion(p_shape_query->get_parameters(), closest_safe, closest_unsafe);
@@ -412,7 +412,7 @@ Vector<real_t> PhysicsDirectSpaceState2D::_cast_motion(const Ref<PhysicsShapeQue
}
TypedArray<Vector2> PhysicsDirectSpaceState2D::_collide_shape(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query, int p_max_results) {
ERR_FAIL_COND_V(!p_shape_query.is_valid(), TypedArray<Vector2>());
ERR_FAIL_COND_V(p_shape_query.is_null(), TypedArray<Vector2>());
Vector<Vector2> ret;
ret.resize(p_max_results * 2);
@@ -430,7 +430,7 @@ TypedArray<Vector2> PhysicsDirectSpaceState2D::_collide_shape(const Ref<PhysicsS
}
Dictionary PhysicsDirectSpaceState2D::_get_rest_info(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query) {
ERR_FAIL_COND_V(!p_shape_query.is_valid(), Dictionary());
ERR_FAIL_COND_V(p_shape_query.is_null(), Dictionary());
ShapeRestInfo sri;
@@ -608,7 +608,7 @@ void PhysicsTestMotionResult2D::_bind_methods() {
///////////////////////////////////////
bool PhysicsServer2D::_body_test_motion(RID p_body, const Ref<PhysicsTestMotionParameters2D> &p_parameters, const Ref<PhysicsTestMotionResult2D> &p_result) {
ERR_FAIL_COND_V(!p_parameters.is_valid(), false);
ERR_FAIL_COND_V(p_parameters.is_null(), false);
MotionResult *result_ptr = nullptr;
if (p_result.is_valid()) {
@@ -896,15 +896,15 @@ PhysicsServer2D::PhysicsServer2D() {
singleton = this;
// World2D physics space
GLOBAL_DEF_BASIC("physics/2d/default_gravity", 980.0);
GLOBAL_DEF_BASIC("physics/2d/default_gravity_vector", Vector2(0, 1));
GLOBAL_DEF_BASIC(PropertyInfo(Variant::FLOAT, "physics/2d/default_gravity", PROPERTY_HINT_RANGE, U"-4096,4096,0.001,or_less,or_greater,suffix:px/s\u00B2"), 980.0);
GLOBAL_DEF_BASIC(PropertyInfo(Variant::VECTOR2, "physics/2d/default_gravity_vector", PROPERTY_HINT_RANGE, "-10,10,0.001,or_less,or_greater"), Vector2(0, 1));
GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "physics/2d/default_linear_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater"), 0.1);
GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "physics/2d/default_angular_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater"), 1.0);
// PhysicsServer2D
GLOBAL_DEF("physics/2d/sleep_threshold_linear", 2.0);
GLOBAL_DEF("physics/2d/sleep_threshold_angular", Math::deg_to_rad(8.0));
GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "physics/2d/time_before_sleep", PROPERTY_HINT_RANGE, "0,5,0.01,or_greater"), 0.5);
GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "physics/2d/sleep_threshold_linear", PROPERTY_HINT_RANGE, "0,10,0.001,or_greater"), 2.0);
GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "physics/2d/sleep_threshold_angular", PROPERTY_HINT_RANGE, "0,90,0.1,radians_as_degrees"), Math::deg_to_rad(8.0));
GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "physics/2d/time_before_sleep", PROPERTY_HINT_RANGE, "0,5,0.01,or_greater,suffix:s"), 0.5);
GLOBAL_DEF(PropertyInfo(Variant::INT, "physics/2d/solver/solver_iterations", PROPERTY_HINT_RANGE, "1,32,1,or_greater"), 16);
GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "physics/2d/solver/contact_recycle_radius", PROPERTY_HINT_RANGE, "0,10,0.01,or_greater"), 1.0);
GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "physics/2d/solver/contact_max_separation", PROPERTY_HINT_RANGE, "0,10,0.01,or_greater"), 1.5);