Closed pcbeard closed 8 months ago
Cache allocations of params and test_motion_result
Instead of allocating these on each call to _physics_process(), allocate once using @onready variables.
Also refactor calls to PhysicsServer3D.body_test_motion() to call a helper function, test_motion() to make the code smaller.
Here's a performance trace taken with these changes:
Cache allocations of params and test_motion_result
Instead of allocating these on each call to _physics_process(), allocate once using @onready variables.
Also refactor calls to PhysicsServer3D.body_test_motion() to call a helper function, test_motion() to make the code smaller.