Fix pickup controller not being rotated correctly

main
copygirl 12 months ago
parent 60e6b8c564
commit 116b09b047
  1. 10
      player/AnimationController.cs

@ -166,13 +166,15 @@ public partial class AnimationController : Node3D
Vector3? _defaultPickupPosition;
void HandleHoldingAnimation(double delta)
{
var posPickup = _defaultPickupPosition ??= _player.Pickup.Position;
posPickup = _player.GlobalPosition + posPickup.Rotated(Vector3.Up, Tau / 2 + _bones["UpperBody"].GlobalRotation.Y);
var posWristR = _bones["Wrist_R"].GlobalPosition;
var posWristL = _bones["Wrist_L"].GlobalPosition;
var bodyYaw = _bones["UpperBody"].GlobalRotation.Y;
var posPickup = _defaultPickupPosition ??= _player.Pickup.Position;
posPickup = _player.GlobalPosition + posPickup.Rotated(Vector3.Up, Tau / 2 + bodyYaw);
_player.Pickup.GlobalPosition = (posPickup + posWristR + posWristL) / 3;
_player.Pickup.Rotation = _player.Pickup.Rotation with { Y = _bones["UpperBody"].Rotation.Y };
_player.Pickup.GlobalRotation = _player.Pickup.GlobalRotation with { Y = bodyYaw };
const string IsHoldingParam = "parameters/is_holding/blend_amount";

Loading…
Cancel
Save