Skip to content

Commit

Permalink
solve shitty hand rotation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
stilnat committed Nov 3, 2024
1 parent 5869a4f commit ce01097
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Assets/Scripts/SS3D/Systems/Animations/PickUpAnimation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public PickUpAnimation(ProceduralAnimationController proceduralAnimationControll

public override void ClientPlay()
{
bool withTwoHands = _secondaryHand is null && _secondaryHand.Empty && _holdable.CanHoldTwoHand;
bool withTwoHands = _secondaryHand is not null && _secondaryHand.Empty && _holdable.CanHoldTwoHand;

SetUpPickup(withTwoHands);

Expand Down Expand Up @@ -65,12 +65,13 @@ private void SetUpPickup(bool withTwoHands)
// Needed to constrain item to position, in case the weight has been changed elsewhere
_mainHand.Hold.ItemPositionConstraint.weight = 1f;

// Place pickup and hold target lockers on the item, at their respective position and rotation.
Controller.HoldController.MovePickupAndHoldTargetLocker(_mainHand, false, _holdable);

// Orient hand in a natural position to reach for item.
OrientTargetForHandRotation(_mainHand);

// Place pickup and hold target lockers on the item, at their respective position and rotation.
Controller.HoldController.MovePickupAndHoldTargetLocker(_mainHand, false, _holdable);

// Needed if this has been changed elsewhere
_mainHand.Hold.PickupIkConstraint.data.tipRotationWeight = 1f;

Expand All @@ -81,8 +82,8 @@ private void SetUpPickup(bool withTwoHands)
// Reproduce changes on secondary hand if necessary.
if (withTwoHands)
{
Controller.HoldController.MovePickupAndHoldTargetLocker(_secondaryHand, true, _holdable);
OrientTargetForHandRotation(_secondaryHand);
Controller.HoldController.MovePickupAndHoldTargetLocker(_secondaryHand, true, _holdable);
_secondaryHand.Hold.PickupIkConstraint.data.tipRotationWeight = 1f;
_secondaryHand.Hold.HoldIkConstraint.data.targetRotationWeight = 0f;
}
Expand Down

0 comments on commit ce01097

Please sign in to comment.