mirror of
https://github.com/godotengine/godot.git
synced 2024-11-10 14:12:51 +00:00
Add a method to set the number of physics solver iterations in 3D
This is only for GodotPhysics, and adds a 3D counterpart to the 2D method that was recently added.
This commit is contained in:
parent
56d7126864
commit
f0a145bbf5
@ -1024,7 +1024,7 @@
|
||||
<argument index="0" name="iterations" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the amount of iterations for calculating velocities of colliding bodies. The greater the amount, the more accurate the collisions, but with a performance loss.
|
||||
Sets the amount of iterations for calculating velocities of colliding bodies. The greater the amount of iterations, the more accurate the collisions will be. However, a greater amount of iterations requires more CPU power, which can decrease performance. The default value is [code]8[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="shape_get_data" qualifiers="const">
|
||||
|
@ -1187,6 +1187,16 @@
|
||||
Activates or deactivates the 3D physics engine.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_collision_iterations">
|
||||
<return type="void">
|
||||
</return>
|
||||
<argument index="0" name="iterations" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the amount of iterations for calculating velocities of colliding bodies. The greater the amount of iterations, the more accurate the collisions will be. However, a greater amount of iterations requires more CPU power, which can decrease performance. The default value is [code]8[/code].
|
||||
[b]Note:[/b] Only has an effect when using the default GodotPhysics engine, not the Bullet physics engine.
|
||||
</description>
|
||||
</method>
|
||||
<method name="shape_get_data" qualifiers="const">
|
||||
<return type="Variant">
|
||||
</return>
|
||||
|
@ -1584,6 +1584,10 @@ void PhysicsServer3DSW::set_active(bool p_active) {
|
||||
active = p_active;
|
||||
};
|
||||
|
||||
void PhysicsServer3DSW::set_collision_iterations(int p_iterations) {
|
||||
iterations = p_iterations;
|
||||
};
|
||||
|
||||
void PhysicsServer3DSW::init() {
|
||||
last_step = 0.001;
|
||||
iterations = 8; // 8?
|
||||
|
@ -367,6 +367,8 @@ public:
|
||||
virtual void end_sync() override;
|
||||
virtual void finish() override;
|
||||
|
||||
virtual void set_collision_iterations(int p_iterations) override;
|
||||
|
||||
virtual bool is_flushing_queries() const override { return flushing_queries; }
|
||||
|
||||
int get_process_info(ProcessInfo p_info) override;
|
||||
|
@ -377,6 +377,7 @@ public:
|
||||
|
||||
FUNC1(free, RID);
|
||||
FUNC1(set_active, bool);
|
||||
FUNC1(set_collision_iterations, int);
|
||||
|
||||
virtual void init() override;
|
||||
virtual void step(real_t p_step) override;
|
||||
|
@ -564,7 +564,7 @@ public:
|
||||
|
||||
virtual bool is_flushing_queries() const = 0;
|
||||
|
||||
virtual void set_collision_iterations(int iterations) = 0;
|
||||
virtual void set_collision_iterations(int p_iterations) = 0;
|
||||
|
||||
enum ProcessInfo {
|
||||
INFO_ACTIVE_OBJECTS,
|
||||
|
@ -740,6 +740,8 @@ void PhysicsServer3D::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_active", "active"), &PhysicsServer3D::set_active);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_collision_iterations", "iterations"), &PhysicsServer3D::set_collision_iterations);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_process_info", "process_info"), &PhysicsServer3D::get_process_info);
|
||||
|
||||
BIND_ENUM_CONSTANT(SHAPE_PLANE);
|
||||
|
@ -740,6 +740,8 @@ public:
|
||||
|
||||
virtual bool is_flushing_queries() const = 0;
|
||||
|
||||
virtual void set_collision_iterations(int p_iterations) = 0;
|
||||
|
||||
enum ProcessInfo {
|
||||
INFO_ACTIVE_OBJECTS,
|
||||
INFO_COLLISION_PAIRS,
|
||||
|
Loading…
Reference in New Issue
Block a user