Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/classes/ProjectSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,12 @@
Sets which physics engine to use for 3D physics.
"DEFAULT" is currently the [url=https://bulletphysics.org]Bullet[/url] physics engine. The "GodotPhysics" engine is still supported as an alternative.
</member>
<member name="physics/3d/physics_interpolation/scene_traversal" type="String" setter="" getter="" default="&quot;DEFAULT&quot;">
The approach used for 3D scene traversal when physics interpolation is enabled.
- [code]DEFAULT[/code]: The default optimized method.
- [code]Legacy[/code]: The previous reference method used for scene tree traversal, which is slower.
- [code]Debug[/code]: Swaps between [code]DEFAULT[/code] and [code]Legacy[/code] methods on alternating frames, and provides logging information (which in turn makes it slower). Intended for debugging only; you should use the [code]DEFAULT[/code] method in most cases.
</member>
<member name="physics/3d/smooth_trimesh_collision" type="bool" setter="" getter="" default="false">
If [code]true[/code], smooths out collision with trimesh shapes ([ConcavePolygonShape]) by telling the Bullet physics engine to generate internal edge information for every trimesh shape created.
[b]Note:[/b] Only effective if [member physics/3d/physics_engine] is set to [code]DEFAULT[/code] or [code]Bullet[/code], [i]not[/i] [code]GodotPhysics[/code].
Expand Down
6 changes: 6 additions & 0 deletions scene/3d/spatial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ void Spatial::_notification(int p_what) {
// unless they need to perform specific tasks (like changing process modes).
fti_pump_xform();
fti_pump_property();

// Detect whether we are using an identity transform.
// This is an optimization for faster tree transform concatenation.
data.fti_is_identity_xform = data.local_transform == Transform();
} break;

case NOTIFICATION_PAUSED: {
Expand Down Expand Up @@ -1127,6 +1131,8 @@ Spatial::Spatial() :
data.fti_on_tick_property_list = false;
data.fti_global_xform_interp_set = false;
data.fti_frame_xform_force_update = false;
data.fti_is_identity_xform = false;
data.fti_processed = false;

data.merging_mode = MERGING_MODE_INHERIT;

Expand Down
3 changes: 3 additions & 0 deletions scene/3d/spatial.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Spatial : public Node {
OBJ_CATEGORY("3D");

friend class SceneTreeFTI;
friend class SceneTreeFTITests;

public:
enum MergingMode : unsigned int {
Expand Down Expand Up @@ -129,6 +130,8 @@ class Spatial : public Node {
bool fti_on_tick_property_list : 1;
bool fti_global_xform_interp_set : 1;
bool fti_frame_xform_force_update : 1;
bool fti_is_identity_xform : 1;
bool fti_processed : 1;

bool merging_allowed : 1;

Expand Down
3 changes: 2 additions & 1 deletion scene/main/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ class Node : public Object {
HashMap<StringName, Node *> owned_unique_nodes;
bool unique_name_in_owner = false;

int32_t depth;
int pos;
int depth;
int blocked; // safeguard that throws an error when attempting to modify the tree in a harmful way while being traversed.
StringName name;
SceneTree *tree;
Expand Down Expand Up @@ -266,6 +266,7 @@ class Node : public Object {
bool _is_physics_interpolation_reset_requested() const { return data.physics_interpolation_reset_requested; }
void _set_use_identity_transform(bool p_enable);
bool _is_using_identity_transform() const { return data.use_identity_transform; }
int32_t _get_scene_tree_depth() const { return data.depth; }

public:
enum {
Expand Down
Loading