Code repair

This commit is contained in:
2026-05-17 09:56:04 +02:00
parent 7e89f37d90
commit 2d7b5481c0
6 changed files with 14 additions and 20 deletions

View File

@@ -106,7 +106,7 @@ public class DraggableObject : MonoBehaviour
rb.isKinematic = false;
rb.linearVelocity = Vector3.zero;
_dragPlane = new Plane(-mainCamera.transform.forward, hitPoint);
targetPosition = hitPoint;
targetPosition = new Vector3(this.transform.position.x, hitPoint.y, hitPoint.z);
transform.localScale = originalScale * scaleOnDrag;
if (Renderer != null)
{
@@ -119,7 +119,8 @@ public class DraggableObject : MonoBehaviour
float distance;
if (_dragPlane.Raycast(ray, out distance))
{
targetPosition = ray.GetPoint(distance);
Vector3 hitPoint = ray.GetPoint(distance);
targetPosition = new Vector3(this.transform.position.x, hitPoint.y, hitPoint.z);
}
}
void EndDrag()

View File

@@ -108,9 +108,9 @@ public class ObjectSpawner : MonoBehaviour
Vector3 RandomPos(float margin)
{
return new Vector3(
-2.24f,//Random.Range(minX + margin, maxX - margin),
0f,//Random.Range(minY + margin, maxY - margin),
0.5f
Random.Range(-3, -4),
-0.3f,
Random.Range(-2f, 1.5f)
);
}
}