Fix dropped/thrown item behavior
This commit is contained in:
@@ -24,15 +24,22 @@ public partial class DroppedItem : RigidBody3D, IDroppedItem
|
||||
{
|
||||
ContactMonitor = true;
|
||||
Sprite.Texture = Item.GetTexture();
|
||||
BodyEntered += DroppedItem_BodyEntered;
|
||||
}
|
||||
|
||||
private void DroppedItem_BodyEntered(Node body)
|
||||
{
|
||||
AngularVelocity = Vector3.Zero;
|
||||
LinearVelocity = Vector3.Zero;
|
||||
}
|
||||
|
||||
public async void Drop()
|
||||
{
|
||||
AddCollisionExceptionWith((Node)Player);
|
||||
|
||||
Pickup.Monitorable = false;
|
||||
Pickup.Monitoring = false;
|
||||
GlobalPosition = Player.GlobalPosition + Vector3.Up;
|
||||
ApplyCentralImpulse(-Player.GlobalBasis.Z.Normalized() * 5.0f);
|
||||
GlobalPosition = new Vector3(Player.GlobalPosition.X, Player.GlobalPosition.Y + 1, Player.GlobalPosition.Z) + (-Player.GlobalBasis.Z * 2);
|
||||
await ToSignal(GetTree().CreateTimer(1), "timeout");
|
||||
RemoveCollisionExceptionWith((Node)Player);
|
||||
Pickup.Monitorable = true;
|
||||
|
||||
Reference in New Issue
Block a user