Skip to content

Commit

Permalink
Merge pull request #2 from Doprez/crash-fix
Browse files Browse the repository at this point in the history
fix crash on expired node
  • Loading branch information
gleblebedev authored Jan 8, 2025
2 parents 189eac7 + 2884fbd commit 5462b62
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions RbfxTemplate/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ private void UpdateArmTargetPositions()
{
foreach (var arm in _armSolvers)
{
if (arm.ArmAtachmentNode != null)
if (arm.ArmAttachmentNode != null && !arm.WieldableAttachmentNode.IsExpired)
{
arm.ArmAtachmentNode.WorldPosition = arm.WieldableAtachmentNode.WorldPosition;
arm.ArmAttachmentNode.WorldPosition = arm.WieldableAttachmentNode.WorldPosition;
}
}
}
Expand Down Expand Up @@ -284,17 +284,17 @@ private void UpdateArmTargets()
var armTarget = this.Node.FindChild(arm.Solver.TargetName, true);
if (armTarget != target)
{
arm.WieldableAtachmentNode = target;
arm.ArmAtachmentNode = armTarget;
arm.WieldableAttachmentNode = target;
arm.ArmAttachmentNode = armTarget;
arm.Solver.PositionWeight = 1;
arm.Solver.RotationWeight = 0;
arm.Solver.BendWeight = 1;
continue;
}
}
}
arm.WieldableAtachmentNode = null;
arm.ArmAtachmentNode = null;
arm.WieldableAttachmentNode = null;
arm.ArmAttachmentNode = null;
arm.Solver.PositionWeight = 0;
arm.Solver.RotationWeight = 0;
arm.Solver.BendWeight = 0;
Expand Down Expand Up @@ -352,9 +352,9 @@ private class ArmSolver
{
public IKArmSolver Solver { get; set; }

public Node ArmAtachmentNode { get; set; }
public Node ArmAttachmentNode { get; set; }

public Node WieldableAtachmentNode { get; set; }
public Node WieldableAttachmentNode { get; set; }
}
}
}

0 comments on commit 5462b62

Please sign in to comment.