diff options
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/area.cpp | 4 | ||||
-rw-r--r-- | scene/3d/arvr_nodes.cpp | 2 | ||||
-rw-r--r-- | scene/3d/cpu_particles.cpp | 20 | ||||
-rw-r--r-- | scene/3d/listener.h | 2 | ||||
-rw-r--r-- | scene/3d/path.cpp | 2 | ||||
-rw-r--r-- | scene/3d/physics_body.cpp | 72 | ||||
-rw-r--r-- | scene/3d/physics_body.h | 18 | ||||
-rw-r--r-- | scene/3d/physics_joint.cpp | 16 | ||||
-rw-r--r-- | scene/3d/physics_joint.h | 7 | ||||
-rw-r--r-- | scene/3d/soft_body.cpp | 2 | ||||
-rw-r--r-- | scene/3d/sprite_3d.cpp | 4 |
11 files changed, 130 insertions, 19 deletions
diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp index 5e78368804..ac77ddb7ce 100644 --- a/scene/3d/area.cpp +++ b/scene/3d/area.cpp @@ -157,7 +157,9 @@ void Area::_body_inout(int p_status, const RID &p_body, int p_instance, int p_bo Map<ObjectID, BodyState>::Element *E = body_map.find(objid); - ERR_FAIL_COND(!body_in && !E); + if (!body_in && !E) { + return; //likely removed from the tree + } locked = true; diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp index 2dc500f7ab..7ea62678da 100644 --- a/scene/3d/arvr_nodes.cpp +++ b/scene/3d/arvr_nodes.cpp @@ -266,6 +266,7 @@ void ARVRController::set_controller_id(int p_controller_id) { // We don't check any bounds here, this controller may not yet be active and just be a place holder until it is. // Note that setting this to 0 means this node is not bound to a controller yet. controller_id = p_controller_id; + update_configuration_warning(); }; int ARVRController::get_controller_id(void) const { @@ -446,6 +447,7 @@ void ARVRAnchor::set_anchor_id(int p_anchor_id) { // We don't check any bounds here, this anchor may not yet be active and just be a place holder until it is. // Note that setting this to 0 means this node is not bound to an anchor yet. anchor_id = p_anchor_id; + update_configuration_warning(); }; int ARVRAnchor::get_anchor_id(void) const { diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp index 69839a0087..b07848e02e 100644 --- a/scene/3d/cpu_particles.cpp +++ b/scene/3d/cpu_particles.cpp @@ -217,7 +217,7 @@ String CPUParticles::get_configuration_warning() const { if (!mesh_found) { if (warnings != String()) warnings += "\n"; - warnings += "- " + TTR("Nothing is visible because no mesh has not been assigned."); + warnings += "- " + TTR("Nothing is visible because no mesh has been assigned."); } if (!anim_material_found && (get_param(PARAM_ANIM_SPEED) != 0.0 || get_param(PARAM_ANIM_OFFSET) != 0.0 || @@ -523,7 +523,7 @@ void CPUParticles::_particles_process(float p_delta) { Basis velocity_xform; if (!local_coords) { emission_xform = get_global_transform(); - velocity_xform = emission_xform.basis.inverse().transposed(); + velocity_xform = emission_xform.basis; } for (int i = 0; i < pcount; i++) { @@ -691,7 +691,7 @@ void CPUParticles::_particles_process(float p_delta) { if (flags[FLAG_DISABLE_Z]) { p.velocity.z = 0.0; - p.velocity.z = 0.0; + p.transform.origin.z = 0.0; } } else if (!p.active) { @@ -757,15 +757,15 @@ void CPUParticles::_particles_process(float p_delta) { } Vector3 force = gravity; - Vector3 pos = p.transform.origin; + Vector3 position = p.transform.origin; if (flags[FLAG_DISABLE_Z]) { - pos.z = 0.0; + position.z = 0.0; } //apply linear acceleration force += p.velocity.length() > 0.0 ? p.velocity.normalized() * (parameters[PARAM_LINEAR_ACCEL] + tex_linear_accel) * Math::lerp(1.0f, rand_from_seed(alt_seed), randomness[PARAM_LINEAR_ACCEL]) : Vector3(); //apply radial acceleration Vector3 org = emission_xform.origin; - Vector3 diff = pos - org; + Vector3 diff = position - org; force += diff.length() > 0.0 ? diff.normalized() * (parameters[PARAM_RADIAL_ACCEL] + tex_radial_accel) * Math::lerp(1.0f, rand_from_seed(alt_seed), randomness[PARAM_RADIAL_ACCEL]) : Vector3(); //apply tangential acceleration; if (flags[FLAG_DISABLE_Z]) { @@ -1361,12 +1361,12 @@ void CPUParticles::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angle_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_ANGLE); ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "angle_curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve"), "set_param_curve", "get_param_curve", PARAM_ANGLE); ADD_GROUP("Scale", ""); - ADD_PROPERTYI(PropertyInfo(Variant::REAL, "scale", PROPERTY_HINT_RANGE, "0,1000,0.01,or_greater"), "set_param", "get_param", PARAM_SCALE); - ADD_PROPERTYI(PropertyInfo(Variant::REAL, "scale_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_SCALE); - ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "scale_curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve"), "set_param_curve", "get_param_curve", PARAM_SCALE); + ADD_PROPERTYI(PropertyInfo(Variant::REAL, "scale_amount", PROPERTY_HINT_RANGE, "0,1000,0.01,or_greater"), "set_param", "get_param", PARAM_SCALE); + ADD_PROPERTYI(PropertyInfo(Variant::REAL, "scale_amount_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_SCALE); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "scale_amount_curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve"), "set_param_curve", "get_param_curve", PARAM_SCALE); ADD_GROUP("Color", ""); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color"); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "color_ramp", PROPERTY_HINT_RESOURCE_TYPE, "GradientTexture"), "set_color_ramp", "get_color_ramp"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "color_ramp", PROPERTY_HINT_RESOURCE_TYPE, "Gradient"), "set_color_ramp", "get_color_ramp"); ADD_GROUP("Hue Variation", "hue_"); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "hue_variation", PROPERTY_HINT_RANGE, "-1,1,0.01"), "set_param", "get_param", PARAM_HUE_VARIATION); diff --git a/scene/3d/listener.h b/scene/3d/listener.h index 8047971ebd..9901f7635c 100644 --- a/scene/3d/listener.h +++ b/scene/3d/listener.h @@ -71,8 +71,6 @@ public: void set_visible_layers(uint32_t p_layers); uint32_t get_visible_layers() const; - Vector<Plane> get_frustum() const; - Listener(); ~Listener(); }; diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp index 339a434a6e..1b253d41e8 100644 --- a/scene/3d/path.cpp +++ b/scene/3d/path.cpp @@ -252,7 +252,7 @@ void PathFollow::_bind_methods() { ClassDB::bind_method(D_METHOD("set_loop", "loop"), &PathFollow::set_loop); ClassDB::bind_method(D_METHOD("has_loop"), &PathFollow::has_loop); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "offset", PROPERTY_HINT_EXP_RANGE, "0,10000,0.01,or_greater"), "set_offset", "get_offset"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "offset", PROPERTY_HINT_RANGE, "0,10000,0.01,or_greater"), "set_offset", "get_offset"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "unit_offset", PROPERTY_HINT_RANGE, "0,1,0.0001", PROPERTY_USAGE_EDITOR), "set_unit_offset", "get_unit_offset"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "h_offset"), "set_h_offset", "get_h_offset"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "v_offset"), "set_v_offset", "get_v_offset"); diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 9148b436a0..bcfcf33e57 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -1907,6 +1907,26 @@ bool PhysicalBone::SixDOFJointData::_set(const StringName &p_name, const Variant if (j.is_valid()) PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS, axis_data[axis].linear_limit_softness); + } else if ("linear_spring_enabled" == var_name) { + axis_data[axis].linear_spring_enabled = p_value; + if (j.is_valid()) + PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(j, axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING, axis_data[axis].linear_spring_enabled); + + } else if ("linear_spring_stiffness" == var_name) { + axis_data[axis].linear_spring_stiffness = p_value; + if (j.is_valid()) + PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS, axis_data[axis].linear_spring_stiffness); + + } else if ("linear_spring_damping" == var_name) { + axis_data[axis].linear_spring_damping = p_value; + if (j.is_valid()) + PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_DAMPING, axis_data[axis].linear_spring_damping); + + } else if ("linear_equilibrium_point" == var_name) { + axis_data[axis].linear_equilibrium_point = p_value; + if (j.is_valid()) + PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT, axis_data[axis].linear_equilibrium_point); + } else if ("linear_restitution" == var_name) { axis_data[axis].linear_restitution = p_value; if (j.is_valid()) @@ -1952,6 +1972,26 @@ bool PhysicalBone::SixDOFJointData::_set(const StringName &p_name, const Variant if (j.is_valid()) PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_ANGULAR_ERP, axis_data[axis].erp); + } else if ("angular_spring_enabled" == var_name) { + axis_data[axis].angular_spring_enabled = p_value; + if (j.is_valid()) + PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(j, axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING, axis_data[axis].angular_spring_enabled); + + } else if ("angular_spring_stiffness" == var_name) { + axis_data[axis].angular_spring_stiffness = p_value; + if (j.is_valid()) + PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS, axis_data[axis].angular_spring_stiffness); + + } else if ("angular_spring_damping" == var_name) { + axis_data[axis].angular_spring_damping = p_value; + if (j.is_valid()) + PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_DAMPING, axis_data[axis].angular_spring_damping); + + } else if ("angular_equilibrium_point" == var_name) { + axis_data[axis].angular_equilibrium_point = p_value; + if (j.is_valid()) + PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT, axis_data[axis].angular_equilibrium_point); + } else { return false; } @@ -1990,6 +2030,14 @@ bool PhysicalBone::SixDOFJointData::_get(const StringName &p_name, Variant &r_re r_ret = axis_data[axis].linear_limit_lower; } else if ("linear_limit_softness" == var_name) { r_ret = axis_data[axis].linear_limit_softness; + } else if ("linear_spring_enabled" == var_name) { + r_ret = axis_data[axis].linear_spring_enabled; + } else if ("linear_spring_stiffness" == var_name) { + r_ret = axis_data[axis].linear_spring_stiffness; + } else if ("linear_spring_damping" == var_name) { + r_ret = axis_data[axis].linear_spring_damping; + } else if ("linear_equilibrium_point" == var_name) { + r_ret = axis_data[axis].linear_equilibrium_point; } else if ("linear_restitution" == var_name) { r_ret = axis_data[axis].linear_restitution; } else if ("linear_damping" == var_name) { @@ -2008,6 +2056,14 @@ bool PhysicalBone::SixDOFJointData::_get(const StringName &p_name, Variant &r_re r_ret = axis_data[axis].angular_damping; } else if ("erp" == var_name) { r_ret = axis_data[axis].erp; + } else if ("angular_spring_enabled" == var_name) { + r_ret = axis_data[axis].angular_spring_enabled; + } else if ("angular_spring_stiffness" == var_name) { + r_ret = axis_data[axis].angular_spring_stiffness; + } else if ("angular_spring_damping" == var_name) { + r_ret = axis_data[axis].angular_spring_damping; + } else if ("angular_equilibrium_point" == var_name) { + r_ret = axis_data[axis].angular_equilibrium_point; } else { return false; } @@ -2022,6 +2078,10 @@ void PhysicalBone::SixDOFJointData::_get_property_list(List<PropertyInfo> *p_lis p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/linear_limit_upper")); p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/linear_limit_lower")); p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/linear_limit_softness", PROPERTY_HINT_RANGE, "0.01,16,0.01")); + p_list->push_back(PropertyInfo(Variant::BOOL, "joint_constraints/" + axis_names[i] + "/linear_spring_enabled")); + p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/linear_spring_stiffness")); + p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/linear_spring_damping")); + p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/linear_equilibrium_point")); p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/linear_restitution", PROPERTY_HINT_RANGE, "0.01,16,0.01")); p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/linear_damping", PROPERTY_HINT_RANGE, "0.01,16,0.01")); p_list->push_back(PropertyInfo(Variant::BOOL, "joint_constraints/" + axis_names[i] + "/angular_limit_enabled")); @@ -2031,6 +2091,10 @@ void PhysicalBone::SixDOFJointData::_get_property_list(List<PropertyInfo> *p_lis p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/angular_restitution", PROPERTY_HINT_RANGE, "0.01,16,0.01")); p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/angular_damping", PROPERTY_HINT_RANGE, "0.01,16,0.01")); p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/erp")); + p_list->push_back(PropertyInfo(Variant::BOOL, "joint_constraints/" + axis_names[i] + "/angular_spring_enabled")); + p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/angular_spring_stiffness")); + p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/angular_spring_damping")); + p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/angular_equilibrium_point")); } } @@ -2294,6 +2358,10 @@ void PhysicalBone::_reload_joint() { PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT, g6dofjd->axis_data[axis].linear_limit_upper); PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT, g6dofjd->axis_data[axis].linear_limit_lower); PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS, g6dofjd->axis_data[axis].linear_limit_softness); + PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING, g6dofjd->axis_data[axis].linear_spring_enabled); + PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS, g6dofjd->axis_data[axis].linear_spring_stiffness); + PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_DAMPING, g6dofjd->axis_data[axis].linear_spring_damping); + PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT, g6dofjd->axis_data[axis].linear_equilibrium_point); PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_RESTITUTION, g6dofjd->axis_data[axis].linear_restitution); PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING, g6dofjd->axis_data[axis].linear_damping); PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, g6dofjd->axis_data[axis].angular_limit_enabled); @@ -2303,6 +2371,10 @@ void PhysicalBone::_reload_joint() { PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION, g6dofjd->axis_data[axis].angular_restitution); PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_DAMPING, g6dofjd->axis_data[axis].angular_damping); PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_ERP, g6dofjd->axis_data[axis].erp); + PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING, g6dofjd->axis_data[axis].angular_spring_enabled); + PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS, g6dofjd->axis_data[axis].angular_spring_stiffness); + PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_DAMPING, g6dofjd->axis_data[axis].angular_spring_damping); + PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT, g6dofjd->axis_data[axis].angular_equilibrium_point); } } break; diff --git a/scene/3d/physics_body.h b/scene/3d/physics_body.h index 20d948b6eb..5474290c07 100644 --- a/scene/3d/physics_body.h +++ b/scene/3d/physics_body.h @@ -494,6 +494,10 @@ public: real_t linear_limit_softness; real_t linear_restitution; real_t linear_damping; + bool linear_spring_enabled; + real_t linear_spring_stiffness; + real_t linear_spring_damping; + real_t linear_equilibrium_point; bool angular_limit_enabled; real_t angular_limit_upper; real_t angular_limit_lower; @@ -501,6 +505,10 @@ public: real_t angular_restitution; real_t angular_damping; real_t erp; + bool angular_spring_enabled; + real_t angular_spring_stiffness; + real_t angular_spring_damping; + real_t angular_equilibrium_point; SixDOFAxisData() : linear_limit_enabled(true), @@ -509,13 +517,21 @@ public: linear_limit_softness(0.7), linear_restitution(0.5), linear_damping(1.), + linear_spring_enabled(false), + linear_spring_stiffness(0), + linear_spring_damping(0), + linear_equilibrium_point(0), angular_limit_enabled(true), angular_limit_upper(0), angular_limit_lower(0), angular_limit_softness(0.5), angular_restitution(0), angular_damping(1.), - erp(0.5) {} + erp(0.5), + angular_spring_enabled(false), + angular_spring_stiffness(0), + angular_spring_damping(0.), + angular_equilibrium_point(0) {} }; virtual JointType get_joint_type() { return JOINT_TYPE_6DOF; } diff --git a/scene/3d/physics_joint.cpp b/scene/3d/physics_joint.cpp index 02c6b1d969..8fd86c940c 100644 --- a/scene/3d/physics_joint.cpp +++ b/scene/3d/physics_joint.cpp @@ -707,6 +707,9 @@ void Generic6DOFJoint::_bind_methods() { ClassDB::bind_method(D_METHOD("set_flag_z", "flag", "value"), &Generic6DOFJoint::set_flag_z); ClassDB::bind_method(D_METHOD("get_flag_z", "flag"), &Generic6DOFJoint::get_flag_z); + ClassDB::bind_method(D_METHOD("set_precision", "precision"), &Generic6DOFJoint::set_precision); + ClassDB::bind_method(D_METHOD("get_precision"), &Generic6DOFJoint::get_precision); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "linear_limit_x/enabled"), "set_flag_x", "get_flag_x", FLAG_ENABLE_LINEAR_LIMIT); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_limit_x/upper_distance"), "set_param_x", "get_param_x", PARAM_LINEAR_UPPER_LIMIT); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_limit_x/lower_distance"), "set_param_x", "get_param_x", PARAM_LINEAR_LOWER_LIMIT); @@ -795,6 +798,8 @@ void Generic6DOFJoint::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_spring_z/damping"), "set_param_z", "get_param_z", PARAM_ANGULAR_SPRING_DAMPING); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_spring_z/equilibrium_point"), "set_param_z", "get_param_z", PARAM_ANGULAR_SPRING_EQUILIBRIUM_POINT); + ADD_PROPERTY(PropertyInfo(Variant::INT, "precision", PROPERTY_HINT_RANGE, "1,99999,1"), "set_precision", "get_precision"); + BIND_ENUM_CONSTANT(PARAM_LINEAR_LOWER_LIMIT); BIND_ENUM_CONSTANT(PARAM_LINEAR_UPPER_LIMIT); BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_SOFTNESS); @@ -907,6 +912,14 @@ bool Generic6DOFJoint::get_flag_z(Flag p_flag) const { return flags_z[p_flag]; } +void Generic6DOFJoint::set_precision(int p_precision) { + precision = p_precision; + + PhysicsServer::get_singleton()->generic_6dof_joint_set_precision( + get_joint(), + precision); +} + RID Generic6DOFJoint::_configure_joint(PhysicsBody *body_a, PhysicsBody *body_b) { Transform gt = get_global_transform(); @@ -941,7 +954,8 @@ RID Generic6DOFJoint::_configure_joint(PhysicsBody *body_a, PhysicsBody *body_b) return j; } -Generic6DOFJoint::Generic6DOFJoint() { +Generic6DOFJoint::Generic6DOFJoint() : + precision(1) { set_param_x(PARAM_LINEAR_LOWER_LIMIT, 0); set_param_x(PARAM_LINEAR_UPPER_LIMIT, 0); diff --git a/scene/3d/physics_joint.h b/scene/3d/physics_joint.h index ee4ca28658..753795da90 100644 --- a/scene/3d/physics_joint.h +++ b/scene/3d/physics_joint.h @@ -305,6 +305,8 @@ protected: float params_z[PARAM_MAX]; bool flags_z[FLAG_MAX]; + int precision; + virtual RID _configure_joint(PhysicsBody *body_a, PhysicsBody *body_b); static void _bind_methods(); @@ -327,6 +329,11 @@ public: void set_flag_z(Flag p_flag, bool p_enabled); bool get_flag_z(Flag p_flag) const; + void set_precision(int p_precision); + int get_precision() const { + return precision; + } + Generic6DOFJoint(); }; diff --git a/scene/3d/soft_body.cpp b/scene/3d/soft_body.cpp index 1e730d0b3d..835a874323 100644 --- a/scene/3d/soft_body.cpp +++ b/scene/3d/soft_body.cpp @@ -401,7 +401,7 @@ String SoftBody::get_configuration_warning() const { } Transform t = get_transform(); - if ((ABS(t.basis.get_axis(0).length() - 1.0) > 0.05 || ABS(t.basis.get_axis(1).length() - 1.0) > 0.05 || ABS(t.basis.get_axis(0).length() - 1.0) > 0.05)) { + if ((ABS(t.basis.get_axis(0).length() - 1.0) > 0.05 || ABS(t.basis.get_axis(1).length() - 1.0) > 0.05 || ABS(t.basis.get_axis(2).length() - 1.0) > 0.05)) { if (!warning.empty()) warning += "\n\n"; diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 5bde224ce3..7b4c7de029 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -463,9 +463,9 @@ void Sprite3D::_draw() { Plane tangent; if (axis == Vector3::AXIS_X) { - tangent = Plane(0, 0, -1, -1); + tangent = Plane(0, 0, -1, 1); } else { - tangent = Plane(1, 0, 0, -1); + tangent = Plane(1, 0, 0, 1); } RID mat = SpatialMaterial::get_material_rid_for_2d(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS); |