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

@@ -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);