Merge pull request #44391 from madmiraal/fix-42285
Remove Generic6DOFJoint precision property
This commit is contained in:
commit
0415a2d913
|
@ -348,8 +348,6 @@
|
||||||
</member>
|
</member>
|
||||||
<member name="linear_spring_z/stiffness" type="float" setter="set_param_z" getter="get_param_z" default="0.01">
|
<member name="linear_spring_z/stiffness" type="float" setter="set_param_z" getter="get_param_z" default="0.01">
|
||||||
</member>
|
</member>
|
||||||
<member name="precision" type="int" setter="set_precision" getter="get_precision" default="1">
|
|
||||||
</member>
|
|
||||||
</members>
|
</members>
|
||||||
<constants>
|
<constants>
|
||||||
<constant name="PARAM_LINEAR_LOWER_LIMIT" value="0" enum="Param">
|
<constant name="PARAM_LINEAR_LOWER_LIMIT" value="0" enum="Param">
|
||||||
|
|
|
@ -1463,22 +1463,6 @@ bool BulletPhysicsServer3D::generic_6dof_joint_get_flag(RID p_joint, Vector3::Ax
|
||||||
return generic_6dof_joint->get_flag(p_axis, p_flag);
|
return generic_6dof_joint->get_flag(p_axis, p_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BulletPhysicsServer3D::generic_6dof_joint_set_precision(RID p_joint, int p_precision) {
|
|
||||||
JointBullet *joint = joint_owner.getornull(p_joint);
|
|
||||||
ERR_FAIL_COND(!joint);
|
|
||||||
ERR_FAIL_COND(joint->get_type() != JOINT_6DOF);
|
|
||||||
Generic6DOFJointBullet *generic_6dof_joint = static_cast<Generic6DOFJointBullet *>(joint);
|
|
||||||
generic_6dof_joint->set_precision(p_precision);
|
|
||||||
}
|
|
||||||
|
|
||||||
int BulletPhysicsServer3D::generic_6dof_joint_get_precision(RID p_joint) {
|
|
||||||
JointBullet *joint = joint_owner.getornull(p_joint);
|
|
||||||
ERR_FAIL_COND_V(!joint, 0);
|
|
||||||
ERR_FAIL_COND_V(joint->get_type() != JOINT_6DOF, 0);
|
|
||||||
Generic6DOFJointBullet *generic_6dof_joint = static_cast<Generic6DOFJointBullet *>(joint);
|
|
||||||
return generic_6dof_joint->get_precision();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BulletPhysicsServer3D::free(RID p_rid) {
|
void BulletPhysicsServer3D::free(RID p_rid) {
|
||||||
if (shape_owner.owns(p_rid)) {
|
if (shape_owner.owns(p_rid)) {
|
||||||
ShapeBullet *shape = shape_owner.getornull(p_rid);
|
ShapeBullet *shape = shape_owner.getornull(p_rid);
|
||||||
|
|
|
@ -376,9 +376,6 @@ public:
|
||||||
virtual void generic_6dof_joint_set_flag(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag, bool p_enable) override;
|
virtual void generic_6dof_joint_set_flag(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag, bool p_enable) override;
|
||||||
virtual bool generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag) override;
|
virtual bool generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag) override;
|
||||||
|
|
||||||
virtual void generic_6dof_joint_set_precision(RID p_joint, int precision) override;
|
|
||||||
virtual int generic_6dof_joint_get_precision(RID p_joint) override;
|
|
||||||
|
|
||||||
/* MISC */
|
/* MISC */
|
||||||
|
|
||||||
virtual void free(RID p_rid) override;
|
virtual void free(RID p_rid) override;
|
||||||
|
|
|
@ -273,11 +273,3 @@ bool Generic6DOFJointBullet::get_flag(Vector3::Axis p_axis, PhysicsServer3D::G6D
|
||||||
ERR_FAIL_INDEX_V(p_axis, 3, false);
|
ERR_FAIL_INDEX_V(p_axis, 3, false);
|
||||||
return flags[p_axis][p_flag];
|
return flags[p_axis][p_flag];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Generic6DOFJointBullet::set_precision(int p_precision) {
|
|
||||||
sixDOFConstraint->setOverrideNumSolverIterations(MAX(1, p_precision));
|
|
||||||
}
|
|
||||||
|
|
||||||
int Generic6DOFJointBullet::get_precision() const {
|
|
||||||
return sixDOFConstraint->getOverrideNumSolverIterations();
|
|
||||||
}
|
|
||||||
|
|
|
@ -68,9 +68,6 @@ public:
|
||||||
|
|
||||||
void set_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag, bool p_value);
|
void set_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag, bool p_value);
|
||||||
bool get_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag) const;
|
bool get_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag) const;
|
||||||
|
|
||||||
void set_precision(int p_precision);
|
|
||||||
int get_precision() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -710,9 +710,6 @@ void Generic6DOFJoint3D::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("set_flag_z", "flag", "value"), &Generic6DOFJoint3D::set_flag_z);
|
ClassDB::bind_method(D_METHOD("set_flag_z", "flag", "value"), &Generic6DOFJoint3D::set_flag_z);
|
||||||
ClassDB::bind_method(D_METHOD("get_flag_z", "flag"), &Generic6DOFJoint3D::get_flag_z);
|
ClassDB::bind_method(D_METHOD("get_flag_z", "flag"), &Generic6DOFJoint3D::get_flag_z);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("set_precision", "precision"), &Generic6DOFJoint3D::set_precision);
|
|
||||||
ClassDB::bind_method(D_METHOD("get_precision"), &Generic6DOFJoint3D::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::BOOL, "linear_limit_x/enabled"), "set_flag_x", "get_flag_x", FLAG_ENABLE_LINEAR_LIMIT);
|
||||||
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "linear_limit_x/upper_distance"), "set_param_x", "get_param_x", PARAM_LINEAR_UPPER_LIMIT);
|
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "linear_limit_x/upper_distance"), "set_param_x", "get_param_x", PARAM_LINEAR_UPPER_LIMIT);
|
||||||
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "linear_limit_x/lower_distance"), "set_param_x", "get_param_x", PARAM_LINEAR_LOWER_LIMIT);
|
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "linear_limit_x/lower_distance"), "set_param_x", "get_param_x", PARAM_LINEAR_LOWER_LIMIT);
|
||||||
|
@ -801,8 +798,6 @@ void Generic6DOFJoint3D::_bind_methods() {
|
||||||
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "angular_spring_z/damping"), "set_param_z", "get_param_z", PARAM_ANGULAR_SPRING_DAMPING);
|
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "angular_spring_z/damping"), "set_param_z", "get_param_z", PARAM_ANGULAR_SPRING_DAMPING);
|
||||||
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "angular_spring_z/equilibrium_point"), "set_param_z", "get_param_z", PARAM_ANGULAR_SPRING_EQUILIBRIUM_POINT);
|
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "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_LOWER_LIMIT);
|
||||||
BIND_ENUM_CONSTANT(PARAM_LINEAR_UPPER_LIMIT);
|
BIND_ENUM_CONSTANT(PARAM_LINEAR_UPPER_LIMIT);
|
||||||
BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_SOFTNESS);
|
BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_SOFTNESS);
|
||||||
|
@ -921,14 +916,6 @@ bool Generic6DOFJoint3D::get_flag_z(Flag p_flag) const {
|
||||||
return flags_z[p_flag];
|
return flags_z[p_flag];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Generic6DOFJoint3D::set_precision(int p_precision) {
|
|
||||||
precision = p_precision;
|
|
||||||
|
|
||||||
PhysicsServer3D::get_singleton()->generic_6dof_joint_set_precision(
|
|
||||||
get_joint(),
|
|
||||||
precision);
|
|
||||||
}
|
|
||||||
|
|
||||||
RID Generic6DOFJoint3D::_configure_joint(PhysicsBody3D *body_a, PhysicsBody3D *body_b) {
|
RID Generic6DOFJoint3D::_configure_joint(PhysicsBody3D *body_a, PhysicsBody3D *body_b) {
|
||||||
Transform gt = get_global_transform();
|
Transform gt = get_global_transform();
|
||||||
//Vector3 cone_twistpos = gt.origin;
|
//Vector3 cone_twistpos = gt.origin;
|
||||||
|
|
|
@ -300,8 +300,6 @@ protected:
|
||||||
float params_z[PARAM_MAX];
|
float params_z[PARAM_MAX];
|
||||||
bool flags_z[FLAG_MAX];
|
bool flags_z[FLAG_MAX];
|
||||||
|
|
||||||
int precision = 1;
|
|
||||||
|
|
||||||
virtual RID _configure_joint(PhysicsBody3D *body_a, PhysicsBody3D *body_b) override;
|
virtual RID _configure_joint(PhysicsBody3D *body_a, PhysicsBody3D *body_b) override;
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
|
@ -324,11 +322,6 @@ public:
|
||||||
void set_flag_z(Flag p_flag, bool p_enabled);
|
void set_flag_z(Flag p_flag, bool p_enabled);
|
||||||
bool get_flag_z(Flag p_flag) const;
|
bool get_flag_z(Flag p_flag) const;
|
||||||
|
|
||||||
void set_precision(int p_precision);
|
|
||||||
int get_precision() const {
|
|
||||||
return precision;
|
|
||||||
}
|
|
||||||
|
|
||||||
Generic6DOFJoint3D();
|
Generic6DOFJoint3D();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -346,9 +346,6 @@ public:
|
||||||
virtual void generic_6dof_joint_set_flag(RID p_joint, Vector3::Axis, G6DOFJointAxisFlag p_flag, bool p_enable) override;
|
virtual void generic_6dof_joint_set_flag(RID p_joint, Vector3::Axis, G6DOFJointAxisFlag p_flag, bool p_enable) override;
|
||||||
virtual bool generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis, G6DOFJointAxisFlag p_flag) override;
|
virtual bool generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis, G6DOFJointAxisFlag p_flag) override;
|
||||||
|
|
||||||
virtual void generic_6dof_joint_set_precision(RID p_joint, int precision) override {}
|
|
||||||
virtual int generic_6dof_joint_get_precision(RID p_joint) override { return 0; }
|
|
||||||
|
|
||||||
virtual JointType joint_get_type(RID p_joint) const override;
|
virtual JointType joint_get_type(RID p_joint) const override;
|
||||||
|
|
||||||
virtual void joint_set_solver_priority(RID p_joint, int p_priority) override;
|
virtual void joint_set_solver_priority(RID p_joint, int p_priority) override;
|
||||||
|
|
|
@ -728,9 +728,6 @@ public:
|
||||||
virtual void generic_6dof_joint_set_flag(RID p_joint, Vector3::Axis, G6DOFJointAxisFlag p_flag, bool p_enable) = 0;
|
virtual void generic_6dof_joint_set_flag(RID p_joint, Vector3::Axis, G6DOFJointAxisFlag p_flag, bool p_enable) = 0;
|
||||||
virtual bool generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis, G6DOFJointAxisFlag p_flag) = 0;
|
virtual bool generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis, G6DOFJointAxisFlag p_flag) = 0;
|
||||||
|
|
||||||
virtual void generic_6dof_joint_set_precision(RID p_joint, int precision) = 0;
|
|
||||||
virtual int generic_6dof_joint_get_precision(RID p_joint) = 0;
|
|
||||||
|
|
||||||
/* QUERY API */
|
/* QUERY API */
|
||||||
|
|
||||||
enum AreaBodyStatus {
|
enum AreaBodyStatus {
|
||||||
|
|
Loading…
Reference in New Issue