Fixing small bugs.

This commit is contained in:
Khauvinkh
2024-08-18 19:27:27 +02:00
parent 9b4726113a
commit 3036732a0d
6 changed files with 2005 additions and 78 deletions

View File

@@ -52,8 +52,13 @@ public class CranePickDrop : MonoBehaviour
if (state == State.Catching)
{
Debug.Assert(handlingBody, this);
Debug.Assert(magnet, this);
if (handlingBody == null)
{
state = State.Idle;
return;
}
magnet.strength = magnetStrength;
if (magnet.IsCloseTo(handlingBody, 2f))

View File

@@ -6,6 +6,8 @@ public class HammerableRigidbody: RigidbodyInteractable
{
public override void Use(InteractionController im)
{
manager = im;
if (im.hands.item == null)
{
base.Use(im);

View File

@@ -15,6 +15,11 @@ public class Magnet : MonoBehaviour
if (otherRb && otherRb.isKinematic == false)
{
if (!otherRb.GetComponent<Product>())
{
return;
}
Vector3 dir = otherRb.position - transform.position;
float dirSq = Vector3.SqrMagnitude(dir);
float forceMagnitude = strength * (1.0f / dirSq);