Skip to content

Commit

Permalink
Fix physical bone update without simulating
Browse files Browse the repository at this point in the history
  • Loading branch information
TokageItLab committed Aug 29, 2024
1 parent c2a4942 commit ca80f77
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions scene/3d/physical_bone_simulator_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,11 @@ void _pb_start_simulation(const PhysicalBoneSimulator3D *p_simulator, Node *p_no
}

void PhysicalBoneSimulator3D::physical_bones_start_simulation_on(const TypedArray<StringName> &p_bones) {
_pose_updated();

simulating = true;
_reset_physical_bones_state();

_pose_updated();

Vector<int> sim_bones;
if (p_bones.size() > 0) {
sim_bones.resize(p_bones.size());
Expand Down Expand Up @@ -357,7 +357,7 @@ void PhysicalBoneSimulator3D::_process_modification() {
if (!skeleton) {
return;
}
if (!enabled) {
if (!simulating) {
for (int i = 0; i < bones.size(); i++) {
if (bones[i].physical_bone) {
if (bones[i].physical_bone->is_simulating_physics() == false) {
Expand Down
1 change: 0 additions & 1 deletion scene/3d/physical_bone_simulator_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class PhysicalBoneSimulator3D : public SkeletonModifier3D {
GDCLASS(PhysicalBoneSimulator3D, SkeletonModifier3D);

bool simulating = false;
bool enabled = true;

struct SimulatedBone {
int parent;
Expand Down

0 comments on commit ca80f77

Please sign in to comment.