Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
09c887f3
Commit
09c887f3
authored
Mar 16, 2018
by
Geoffrey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented interface for bullet joint motors
parent
cc617dc5
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
107 additions
and
20 deletions
+107
-20
Generic6DOFJoint.xml
doc/classes/Generic6DOFJoint.xml
+46
-11
PhysicsServer.xml
doc/classes/PhysicsServer.xml
+18
-9
generic_6dof_joint_bullet.cpp
modules/bullet/generic_6dof_joint_bullet.cpp
+13
-0
physics_joint.cpp
scene/3d/physics_joint.cpp
+21
-0
physics_joint.h
scene/3d/physics_joint.h
+3
-0
physics_server.cpp
servers/physics_server.cpp
+3
-0
physics_server.h
servers/physics_server.h
+3
-0
No files found.
doc/classes/Generic6DOFJoint.xml
View file @
09c887f3
...
...
@@ -167,6 +167,33 @@
<member
name=
"linear_limit_z/upper_distance"
type=
"float"
setter=
"set_param_z"
getter=
"get_param_z"
>
The maximum difference between the pivot points' z-axis.
</member>
<member
name=
"linear_motor_x/enabled"
type=
"bool"
setter=
"set_flag_x"
getter=
"get_flag_x"
>
If [code]true[/code] then there is a linear motor on the x-axis. It will attempt to reach the target velocity while staying within the force limits.
</member>
<member
name=
"linear_motor_x/force_limit"
type=
"float"
setter=
"set_param_x"
getter=
"get_param_x"
>
The maximum force the linear motor can apply on the x-axis while trying to reach the target velocity.
</member>
<member
name=
"linear_motor_x/target_velocity"
type=
"float"
setter=
"set_param_x"
getter=
"get_param_x"
>
The speed that the linear motor will attempt to reach on the x-axis.
</member>
<member
name=
"linear_motor_y/enabled"
type=
"bool"
setter=
"set_flag_y"
getter=
"get_flag_y"
>
If [code]true[/code] then there is a linear motor on the y-axis. It will attempt to reach the target velocity while staying within the force limits.
</member>
<member
name=
"linear_motor_y/force_limit"
type=
"float"
setter=
"set_param_y"
getter=
"get_param_y"
>
The maximum force the linear motor can apply on the y-axis while trying to reach the target velocity.
</member>
<member
name=
"linear_motor_y/target_velocity"
type=
"float"
setter=
"set_param_y"
getter=
"get_param_y"
>
The speed that the linear motor will attempt to reach on the y-axis.
</member>
<member
name=
"linear_motor_z/enabled"
type=
"bool"
setter=
"set_flag_z"
getter=
"get_flag_z"
>
If [code]true[/code] then there is a linear motor on the z-axis. It will attempt to reach the target velocity while staying within the force limits.
</member>
<member
name=
"linear_motor_z/force_limit"
type=
"float"
setter=
"set_param_z"
getter=
"get_param_z"
>
The maximum force the linear motor can apply on the z-axis while trying to reach the target velocity.
</member>
<member
name=
"linear_motor_z/target_velocity"
type=
"float"
setter=
"set_param_z"
getter=
"get_param_z"
>
The speed that the linear motor will attempt to reach on the z-axis.
</member>
</members>
<constants>
<constant
name=
"PARAM_LINEAR_LOWER_LIMIT"
value=
"0"
enum=
"Param"
>
...
...
@@ -184,34 +211,40 @@
<constant
name=
"PARAM_LINEAR_DAMPING"
value=
"4"
enum=
"Param"
>
The amount of damping that happens at the linear motion across the axes.
</constant>
<constant
name=
"PARAM_ANGULAR_LOWER_LIMIT"
value=
"5"
enum=
"Param"
>
<constant
name=
"PARAM_LINEAR_MOTOR_TARGET_VELOCITY"
value=
"5"
enum=
"Param"
>
The velocity the linear motor will try to reach.
</constant>
<constant
name=
"PARAM_LINEAR_MOTOR_FORCE_LIMIT"
value=
"6"
enum=
"Param"
>
The maximum force the linear motor will apply while trying to reach the velocity target.
</constant>
<constant
name=
"PARAM_ANGULAR_LOWER_LIMIT"
value=
"7"
enum=
"Param"
>
The minimum rotation in negative direction to break loose and rotate around the axes.
</constant>
<constant
name=
"PARAM_ANGULAR_UPPER_LIMIT"
value=
"
6
"
enum=
"Param"
>
<constant
name=
"PARAM_ANGULAR_UPPER_LIMIT"
value=
"
8
"
enum=
"Param"
>
The minimum rotation in positive direction to break loose and rotate around the axes.
</constant>
<constant
name=
"PARAM_ANGULAR_LIMIT_SOFTNESS"
value=
"
7
"
enum=
"Param"
>
<constant
name=
"PARAM_ANGULAR_LIMIT_SOFTNESS"
value=
"
9
"
enum=
"Param"
>
The speed of all rotations across the axes.
</constant>
<constant
name=
"PARAM_ANGULAR_DAMPING"
value=
"
8
"
enum=
"Param"
>
<constant
name=
"PARAM_ANGULAR_DAMPING"
value=
"
10
"
enum=
"Param"
>
The amount of rotational damping across the axes. The lower, the more dampening occurs.
</constant>
<constant
name=
"PARAM_ANGULAR_RESTITUTION"
value=
"
9
"
enum=
"Param"
>
<constant
name=
"PARAM_ANGULAR_RESTITUTION"
value=
"
11
"
enum=
"Param"
>
The amount of rotational restitution across the axes. The lower, the more restitution occurs.
</constant>
<constant
name=
"PARAM_ANGULAR_FORCE_LIMIT"
value=
"1
0
"
enum=
"Param"
>
<constant
name=
"PARAM_ANGULAR_FORCE_LIMIT"
value=
"1
2
"
enum=
"Param"
>
The maximum amount of force that can occur, when rotating around the axes.
</constant>
<constant
name=
"PARAM_ANGULAR_ERP"
value=
"1
1
"
enum=
"Param"
>
<constant
name=
"PARAM_ANGULAR_ERP"
value=
"1
3
"
enum=
"Param"
>
When rotating across the axes, this error tolerance factor defines how much the correction gets slowed down. The lower, the slower.
</constant>
<constant
name=
"PARAM_ANGULAR_MOTOR_TARGET_VELOCITY"
value=
"1
2
"
enum=
"Param"
>
<constant
name=
"PARAM_ANGULAR_MOTOR_TARGET_VELOCITY"
value=
"1
4
"
enum=
"Param"
>
Target speed for the motor at the axes.
</constant>
<constant
name=
"PARAM_ANGULAR_MOTOR_FORCE_LIMIT"
value=
"1
3
"
enum=
"Param"
>
<constant
name=
"PARAM_ANGULAR_MOTOR_FORCE_LIMIT"
value=
"1
5
"
enum=
"Param"
>
Maximum acceleration for the motor at the axes.
</constant>
<constant
name=
"PARAM_MAX"
value=
"1
4
"
enum=
"Param"
>
<constant
name=
"PARAM_MAX"
value=
"1
6
"
enum=
"Param"
>
End flag of PARAM_* constants, used internally.
</constant>
<constant
name=
"FLAG_ENABLE_LINEAR_LIMIT"
value=
"0"
enum=
"Flag"
>
...
...
@@ -223,7 +256,9 @@
<constant
name=
"FLAG_ENABLE_MOTOR"
value=
"2"
enum=
"Flag"
>
If [code]set[/code] there is a rotational motor across these axes.
</constant>
<constant
name=
"FLAG_MAX"
value=
"3"
enum=
"Flag"
>
<constant
name=
"FLAG_ENABLE_LINEAR_MOTOR"
value=
"3"
enum=
"Flag"
>
</constant>
<constant
name=
"FLAG_MAX"
value=
"4"
enum=
"Flag"
>
End flag of FLAG_* constants, used internally.
</constant>
</constants>
...
...
doc/classes/PhysicsServer.xml
View file @
09c887f3
...
...
@@ -1331,31 +1331,37 @@
<constant
name=
"G6DOF_JOINT_LINEAR_DAMPING"
value=
"4"
enum=
"G6DOFJointAxisParam"
>
The amount of damping that happens at the linear motion across the axes.
</constant>
<constant
name=
"G6DOF_JOINT_ANGULAR_LOWER_LIMIT"
value=
"5"
enum=
"G6DOFJointAxisParam"
>
<constant
name=
"G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY"
value=
"5"
enum=
"G6DOFJointAxisParam"
>
The velocity that the joint's linear motor will attempt to reach.
</constant>
<constant
name=
"G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT"
value=
"6"
enum=
"G6DOFJointAxisParam"
>
The maximum force that the linear motor can apply while trying to reach the target velocity.
</constant>
<constant
name=
"G6DOF_JOINT_ANGULAR_LOWER_LIMIT"
value=
"7"
enum=
"G6DOFJointAxisParam"
>
The minimum rotation in negative direction to break loose and rotate around the axes.
</constant>
<constant
name=
"G6DOF_JOINT_ANGULAR_UPPER_LIMIT"
value=
"
6
"
enum=
"G6DOFJointAxisParam"
>
<constant
name=
"G6DOF_JOINT_ANGULAR_UPPER_LIMIT"
value=
"
8
"
enum=
"G6DOFJointAxisParam"
>
The minimum rotation in positive direction to break loose and rotate around the axes.
</constant>
<constant
name=
"G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS"
value=
"
7
"
enum=
"G6DOFJointAxisParam"
>
<constant
name=
"G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS"
value=
"
9
"
enum=
"G6DOFJointAxisParam"
>
A factor that gets multiplied onto all rotations across the axes.
</constant>
<constant
name=
"G6DOF_JOINT_ANGULAR_DAMPING"
value=
"
8
"
enum=
"G6DOFJointAxisParam"
>
<constant
name=
"G6DOF_JOINT_ANGULAR_DAMPING"
value=
"
10
"
enum=
"G6DOFJointAxisParam"
>
The amount of rotational damping across the axes. The lower, the more dampening occurs.
</constant>
<constant
name=
"G6DOF_JOINT_ANGULAR_RESTITUTION"
value=
"
9
"
enum=
"G6DOFJointAxisParam"
>
<constant
name=
"G6DOF_JOINT_ANGULAR_RESTITUTION"
value=
"
11
"
enum=
"G6DOFJointAxisParam"
>
The amount of rotational restitution across the axes. The lower, the more restitution occurs.
</constant>
<constant
name=
"G6DOF_JOINT_ANGULAR_FORCE_LIMIT"
value=
"1
0
"
enum=
"G6DOFJointAxisParam"
>
<constant
name=
"G6DOF_JOINT_ANGULAR_FORCE_LIMIT"
value=
"1
2
"
enum=
"G6DOFJointAxisParam"
>
The maximum amount of force that can occur, when rotating around the axes.
</constant>
<constant
name=
"G6DOF_JOINT_ANGULAR_ERP"
value=
"1
1
"
enum=
"G6DOFJointAxisParam"
>
<constant
name=
"G6DOF_JOINT_ANGULAR_ERP"
value=
"1
3
"
enum=
"G6DOFJointAxisParam"
>
When correcting the crossing of limits in rotation across the axes, this error tolerance factor defines how much the correction gets slowed down. The lower, the slower.
</constant>
<constant
name=
"G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY"
value=
"1
2
"
enum=
"G6DOFJointAxisParam"
>
<constant
name=
"G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY"
value=
"1
4
"
enum=
"G6DOFJointAxisParam"
>
Target speed for the motor at the axes.
</constant>
<constant
name=
"G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT"
value=
"1
3
"
enum=
"G6DOFJointAxisParam"
>
<constant
name=
"G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT"
value=
"1
5
"
enum=
"G6DOFJointAxisParam"
>
Maximum acceleration for the motor at the axes.
</constant>
<constant
name=
"G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT"
value=
"0"
enum=
"G6DOFJointAxisFlag"
>
...
...
@@ -1367,6 +1373,9 @@
<constant
name=
"G6DOF_JOINT_FLAG_ENABLE_MOTOR"
value=
"2"
enum=
"G6DOFJointAxisFlag"
>
If [code]set[/code] there is a rotational motor across these axes.
</constant>
<constant
name=
"G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR"
value=
"3"
enum=
"G6DOFJointAxisFlag"
>
If [code]set[/code] there is a linear motor on this axis that targets a specific velocity.
</constant>
<constant
name=
"SHAPE_PLANE"
value=
"0"
enum=
"ShapeType"
>
The [Shape] is a [PlaneShape].
</constant>
...
...
modules/bullet/generic_6dof_joint_bullet.cpp
View file @
09c887f3
...
...
@@ -138,6 +138,12 @@ void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DO
case
PhysicsServer
:
:
G6DOF_JOINT_LINEAR_DAMPING
:
sixDOFConstraint
->
getTranslationalLimitMotor
()
->
m_damping
=
p_value
;
break
;
case
PhysicsServer
:
:
G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY
:
sixDOFConstraint
->
getTranslationalLimitMotor
()
->
m_targetVelocity
.
m_floats
[
p_axis
]
=
p_value
;
break
;
case
PhysicsServer
:
:
G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT
:
sixDOFConstraint
->
getTranslationalLimitMotor
()
->
m_maxMotorForce
.
m_floats
[
p_axis
]
=
p_value
;
break
;
case
PhysicsServer
:
:
G6DOF_JOINT_ANGULAR_LOWER_LIMIT
:
limits_lower
[
1
][
p_axis
]
=
p_value
;
set_flag
(
p_axis
,
PhysicsServer
::
G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT
,
flags
[
p_axis
][
p_param
]);
// Reload bullet parameter
...
...
@@ -185,6 +191,10 @@ real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer::G6
return
sixDOFConstraint
->
getTranslationalLimitMotor
()
->
m_restitution
;
case
PhysicsServer
:
:
G6DOF_JOINT_LINEAR_DAMPING
:
return
sixDOFConstraint
->
getTranslationalLimitMotor
()
->
m_damping
;
case
PhysicsServer
:
:
G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY
:
return
sixDOFConstraint
->
getTranslationalLimitMotor
()
->
m_targetVelocity
.
m_floats
[
p_axis
];
case
PhysicsServer
:
:
G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT
:
return
sixDOFConstraint
->
getTranslationalLimitMotor
()
->
m_maxMotorForce
.
m_floats
[
p_axis
];
case
PhysicsServer
:
:
G6DOF_JOINT_ANGULAR_LOWER_LIMIT
:
return
limits_lower
[
1
][
p_axis
];
case
PhysicsServer
:
:
G6DOF_JOINT_ANGULAR_UPPER_LIMIT
:
...
...
@@ -232,6 +242,9 @@ void Generic6DOFJointBullet::set_flag(Vector3::Axis p_axis, PhysicsServer::G6DOF
case
PhysicsServer
:
:
G6DOF_JOINT_FLAG_ENABLE_MOTOR
:
sixDOFConstraint
->
getRotationalLimitMotor
(
p_axis
)
->
m_enableMotor
=
flags
[
p_axis
][
p_flag
];
break
;
case
PhysicsServer
:
:
G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR
:
sixDOFConstraint
->
getTranslationalLimitMotor
()
->
m_enableMotor
[
p_axis
]
=
flags
[
p_axis
][
p_flag
];
break
;
default
:
WARN_PRINT
(
"This flag is not supported by Bullet engine"
);
return
;
...
...
scene/3d/physics_joint.cpp
View file @
09c887f3
...
...
@@ -716,6 +716,9 @@ void Generic6DOFJoint::_bind_methods() {
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
REAL
,
"linear_limit_x/softness"
,
PROPERTY_HINT_RANGE
,
"0.01,16,0.01"
),
"set_param_x"
,
"get_param_x"
,
PARAM_LINEAR_LIMIT_SOFTNESS
);
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
REAL
,
"linear_limit_x/restitution"
,
PROPERTY_HINT_RANGE
,
"0.01,16,0.01"
),
"set_param_x"
,
"get_param_x"
,
PARAM_LINEAR_RESTITUTION
);
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
REAL
,
"linear_limit_x/damping"
,
PROPERTY_HINT_RANGE
,
"0.01,16,0.01"
),
"set_param_x"
,
"get_param_x"
,
PARAM_LINEAR_DAMPING
);
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
BOOL
,
"linear_motor_x/enabled"
),
"set_flag_x"
,
"get_flag_x"
,
FLAG_ENABLE_LINEAR_MOTOR
);
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
REAL
,
"linear_motor_x/target_velocity"
),
"set_param_x"
,
"get_param_x"
,
PARAM_LINEAR_MOTOR_TARGET_VELOCITY
);
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
REAL
,
"linear_motor_x/force_limit"
),
"set_param_x"
,
"get_param_x"
,
PARAM_LINEAR_MOTOR_FORCE_LIMIT
);
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
BOOL
,
"angular_limit_x/enabled"
),
"set_flag_x"
,
"get_flag_x"
,
FLAG_ENABLE_ANGULAR_LIMIT
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
REAL
,
"angular_limit_x/upper_angle"
,
PROPERTY_HINT_RANGE
,
"-180,180,0.01"
),
"_set_angular_hi_limit_x"
,
"_get_angular_hi_limit_x"
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
REAL
,
"angular_limit_x/lower_angle"
,
PROPERTY_HINT_RANGE
,
"-180,180,0.01"
),
"_set_angular_lo_limit_x"
,
"_get_angular_lo_limit_x"
);
...
...
@@ -734,6 +737,9 @@ void Generic6DOFJoint::_bind_methods() {
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
REAL
,
"linear_limit_y/softness"
,
PROPERTY_HINT_RANGE
,
"0.01,16,0.01"
),
"set_param_y"
,
"get_param_y"
,
PARAM_LINEAR_LIMIT_SOFTNESS
);
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
REAL
,
"linear_limit_y/restitution"
,
PROPERTY_HINT_RANGE
,
"0.01,16,0.01"
),
"set_param_y"
,
"get_param_y"
,
PARAM_LINEAR_RESTITUTION
);
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
REAL
,
"linear_limit_y/damping"
,
PROPERTY_HINT_RANGE
,
"0.01,16,0.01"
),
"set_param_y"
,
"get_param_y"
,
PARAM_LINEAR_DAMPING
);
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
BOOL
,
"linear_motor_y/enabled"
),
"set_flag_y"
,
"get_flag_y"
,
FLAG_ENABLE_LINEAR_MOTOR
);
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
REAL
,
"linear_motor_y/target_velocity"
),
"set_param_y"
,
"get_param_y"
,
PARAM_LINEAR_MOTOR_TARGET_VELOCITY
);
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
REAL
,
"linear_motor_y/force_limit"
),
"set_param_y"
,
"get_param_y"
,
PARAM_LINEAR_MOTOR_FORCE_LIMIT
);
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
BOOL
,
"angular_limit_y/enabled"
),
"set_flag_y"
,
"get_flag_y"
,
FLAG_ENABLE_ANGULAR_LIMIT
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
REAL
,
"angular_limit_y/upper_angle"
,
PROPERTY_HINT_RANGE
,
"-180,180,0.01"
),
"_set_angular_hi_limit_y"
,
"_get_angular_hi_limit_y"
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
REAL
,
"angular_limit_y/lower_angle"
,
PROPERTY_HINT_RANGE
,
"-180,180,0.01"
),
"_set_angular_lo_limit_y"
,
"_get_angular_lo_limit_y"
);
...
...
@@ -752,6 +758,9 @@ void Generic6DOFJoint::_bind_methods() {
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
REAL
,
"linear_limit_z/softness"
,
PROPERTY_HINT_RANGE
,
"0.01,16,0.01"
),
"set_param_z"
,
"get_param_z"
,
PARAM_LINEAR_LIMIT_SOFTNESS
);
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
REAL
,
"linear_limit_z/restitution"
,
PROPERTY_HINT_RANGE
,
"0.01,16,0.01"
),
"set_param_z"
,
"get_param_z"
,
PARAM_LINEAR_RESTITUTION
);
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
REAL
,
"linear_limit_z/damping"
,
PROPERTY_HINT_RANGE
,
"0.01,16,0.01"
),
"set_param_z"
,
"get_param_z"
,
PARAM_LINEAR_DAMPING
);
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
BOOL
,
"linear_motor_z/enabled"
),
"set_flag_z"
,
"get_flag_z"
,
FLAG_ENABLE_LINEAR_MOTOR
);
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
REAL
,
"linear_motor_z/target_velocity"
),
"set_param_z"
,
"get_param_z"
,
PARAM_LINEAR_MOTOR_TARGET_VELOCITY
);
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
REAL
,
"linear_motor_z/force_limit"
),
"set_param_z"
,
"get_param_z"
,
PARAM_LINEAR_MOTOR_FORCE_LIMIT
);
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
BOOL
,
"angular_limit_z/enabled"
),
"set_flag_z"
,
"get_flag_z"
,
FLAG_ENABLE_ANGULAR_LIMIT
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
REAL
,
"angular_limit_z/upper_angle"
,
PROPERTY_HINT_RANGE
,
"-180,180,0.01"
),
"_set_angular_hi_limit_z"
,
"_get_angular_hi_limit_z"
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
REAL
,
"angular_limit_z/lower_angle"
,
PROPERTY_HINT_RANGE
,
"-180,180,0.01"
),
"_set_angular_lo_limit_z"
,
"_get_angular_lo_limit_z"
);
...
...
@@ -769,6 +778,8 @@ void Generic6DOFJoint::_bind_methods() {
BIND_ENUM_CONSTANT
(
PARAM_LINEAR_LIMIT_SOFTNESS
);
BIND_ENUM_CONSTANT
(
PARAM_LINEAR_RESTITUTION
);
BIND_ENUM_CONSTANT
(
PARAM_LINEAR_DAMPING
);
BIND_ENUM_CONSTANT
(
PARAM_LINEAR_MOTOR_TARGET_VELOCITY
);
BIND_ENUM_CONSTANT
(
PARAM_LINEAR_MOTOR_FORCE_LIMIT
);
BIND_ENUM_CONSTANT
(
PARAM_ANGULAR_LOWER_LIMIT
);
BIND_ENUM_CONSTANT
(
PARAM_ANGULAR_UPPER_LIMIT
);
BIND_ENUM_CONSTANT
(
PARAM_ANGULAR_LIMIT_SOFTNESS
);
...
...
@@ -783,6 +794,7 @@ void Generic6DOFJoint::_bind_methods() {
BIND_ENUM_CONSTANT
(
FLAG_ENABLE_LINEAR_LIMIT
);
BIND_ENUM_CONSTANT
(
FLAG_ENABLE_ANGULAR_LIMIT
);
BIND_ENUM_CONSTANT
(
FLAG_ENABLE_MOTOR
);
BIND_ENUM_CONSTANT
(
FLAG_ENABLE_LINEAR_MOTOR
);
BIND_ENUM_CONSTANT
(
FLAG_MAX
);
}
...
...
@@ -912,6 +924,8 @@ Generic6DOFJoint::Generic6DOFJoint() {
set_param_x
(
PARAM_LINEAR_LIMIT_SOFTNESS
,
0.7
);
set_param_x
(
PARAM_LINEAR_RESTITUTION
,
0.5
);
set_param_x
(
PARAM_LINEAR_DAMPING
,
1.0
);
set_param_x
(
PARAM_LINEAR_MOTOR_TARGET_VELOCITY
,
0
);
set_param_x
(
PARAM_LINEAR_MOTOR_FORCE_LIMIT
,
0
);
set_param_x
(
PARAM_ANGULAR_LOWER_LIMIT
,
0
);
set_param_x
(
PARAM_ANGULAR_UPPER_LIMIT
,
0
);
set_param_x
(
PARAM_ANGULAR_LIMIT_SOFTNESS
,
0.5
f
);
...
...
@@ -925,12 +939,15 @@ Generic6DOFJoint::Generic6DOFJoint() {
set_flag_x
(
FLAG_ENABLE_ANGULAR_LIMIT
,
true
);
set_flag_x
(
FLAG_ENABLE_LINEAR_LIMIT
,
true
);
set_flag_x
(
FLAG_ENABLE_MOTOR
,
false
);
set_flag_x
(
FLAG_ENABLE_LINEAR_MOTOR
,
false
);
set_param_y
(
PARAM_LINEAR_LOWER_LIMIT
,
0
);
set_param_y
(
PARAM_LINEAR_UPPER_LIMIT
,
0
);
set_param_y
(
PARAM_LINEAR_LIMIT_SOFTNESS
,
0.7
);
set_param_y
(
PARAM_LINEAR_RESTITUTION
,
0.5
);
set_param_y
(
PARAM_LINEAR_DAMPING
,
1.0
);
set_param_y
(
PARAM_LINEAR_MOTOR_TARGET_VELOCITY
,
0
);
set_param_y
(
PARAM_LINEAR_MOTOR_FORCE_LIMIT
,
0
);
set_param_y
(
PARAM_ANGULAR_LOWER_LIMIT
,
0
);
set_param_y
(
PARAM_ANGULAR_UPPER_LIMIT
,
0
);
set_param_y
(
PARAM_ANGULAR_LIMIT_SOFTNESS
,
0.5
f
);
...
...
@@ -944,12 +961,15 @@ Generic6DOFJoint::Generic6DOFJoint() {
set_flag_y
(
FLAG_ENABLE_ANGULAR_LIMIT
,
true
);
set_flag_y
(
FLAG_ENABLE_LINEAR_LIMIT
,
true
);
set_flag_y
(
FLAG_ENABLE_MOTOR
,
false
);
set_flag_y
(
FLAG_ENABLE_LINEAR_MOTOR
,
false
);
set_param_z
(
PARAM_LINEAR_LOWER_LIMIT
,
0
);
set_param_z
(
PARAM_LINEAR_UPPER_LIMIT
,
0
);
set_param_z
(
PARAM_LINEAR_LIMIT_SOFTNESS
,
0.7
);
set_param_z
(
PARAM_LINEAR_RESTITUTION
,
0.5
);
set_param_z
(
PARAM_LINEAR_DAMPING
,
1.0
);
set_param_z
(
PARAM_LINEAR_MOTOR_TARGET_VELOCITY
,
0
);
set_param_z
(
PARAM_LINEAR_MOTOR_FORCE_LIMIT
,
0
);
set_param_z
(
PARAM_ANGULAR_LOWER_LIMIT
,
0
);
set_param_z
(
PARAM_ANGULAR_UPPER_LIMIT
,
0
);
set_param_z
(
PARAM_ANGULAR_LIMIT_SOFTNESS
,
0.5
f
);
...
...
@@ -963,4 +983,5 @@ Generic6DOFJoint::Generic6DOFJoint() {
set_flag_z
(
FLAG_ENABLE_ANGULAR_LIMIT
,
true
);
set_flag_z
(
FLAG_ENABLE_LINEAR_LIMIT
,
true
);
set_flag_z
(
FLAG_ENABLE_MOTOR
,
false
);
set_flag_z
(
FLAG_ENABLE_LINEAR_MOTOR
,
false
);
}
scene/3d/physics_joint.h
View file @
09c887f3
...
...
@@ -249,6 +249,8 @@ public:
PARAM_LINEAR_LIMIT_SOFTNESS
=
PhysicsServer
::
G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS
,
PARAM_LINEAR_RESTITUTION
=
PhysicsServer
::
G6DOF_JOINT_LINEAR_RESTITUTION
,
PARAM_LINEAR_DAMPING
=
PhysicsServer
::
G6DOF_JOINT_LINEAR_DAMPING
,
PARAM_LINEAR_MOTOR_TARGET_VELOCITY
=
PhysicsServer
::
G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY
,
PARAM_LINEAR_MOTOR_FORCE_LIMIT
=
PhysicsServer
::
G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT
,
PARAM_ANGULAR_LOWER_LIMIT
=
PhysicsServer
::
G6DOF_JOINT_ANGULAR_LOWER_LIMIT
,
PARAM_ANGULAR_UPPER_LIMIT
=
PhysicsServer
::
G6DOF_JOINT_ANGULAR_UPPER_LIMIT
,
PARAM_ANGULAR_LIMIT_SOFTNESS
=
PhysicsServer
::
G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS
,
...
...
@@ -265,6 +267,7 @@ public:
FLAG_ENABLE_LINEAR_LIMIT
=
PhysicsServer
::
G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT
,
FLAG_ENABLE_ANGULAR_LIMIT
=
PhysicsServer
::
G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT
,
FLAG_ENABLE_MOTOR
=
PhysicsServer
::
G6DOF_JOINT_FLAG_ENABLE_MOTOR
,
FLAG_ENABLE_LINEAR_MOTOR
=
PhysicsServer
::
G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR
,
FLAG_MAX
=
PhysicsServer
::
G6DOF_JOINT_FLAG_MAX
};
...
...
servers/physics_server.cpp
View file @
09c887f3
...
...
@@ -603,6 +603,8 @@ void PhysicsServer::_bind_methods() {
BIND_ENUM_CONSTANT
(
G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS
);
BIND_ENUM_CONSTANT
(
G6DOF_JOINT_LINEAR_RESTITUTION
);
BIND_ENUM_CONSTANT
(
G6DOF_JOINT_LINEAR_DAMPING
);
BIND_ENUM_CONSTANT
(
G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY
);
BIND_ENUM_CONSTANT
(
G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT
);
BIND_ENUM_CONSTANT
(
G6DOF_JOINT_ANGULAR_LOWER_LIMIT
);
BIND_ENUM_CONSTANT
(
G6DOF_JOINT_ANGULAR_UPPER_LIMIT
);
BIND_ENUM_CONSTANT
(
G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS
);
...
...
@@ -616,6 +618,7 @@ void PhysicsServer::_bind_methods() {
BIND_ENUM_CONSTANT
(
G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT
);
BIND_ENUM_CONSTANT
(
G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT
);
BIND_ENUM_CONSTANT
(
G6DOF_JOINT_FLAG_ENABLE_MOTOR
);
BIND_ENUM_CONSTANT
(
G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR
);
ClassDB
::
bind_method
(
D_METHOD
(
"joint_get_type"
,
"joint"
),
&
PhysicsServer
::
joint_get_type
);
...
...
servers/physics_server.h
View file @
09c887f3
...
...
@@ -594,6 +594,8 @@ public:
G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS
,
G6DOF_JOINT_LINEAR_RESTITUTION
,
G6DOF_JOINT_LINEAR_DAMPING
,
G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY
,
G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT
,
G6DOF_JOINT_ANGULAR_LOWER_LIMIT
,
G6DOF_JOINT_ANGULAR_UPPER_LIMIT
,
G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS
,
...
...
@@ -611,6 +613,7 @@ public:
G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT
,
G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT
,
G6DOF_JOINT_FLAG_ENABLE_MOTOR
,
G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR
,
G6DOF_JOINT_FLAG_MAX
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment