В этом скрипте из точки в сторону курсора выпускается луч, и если он попадает на крючок, то одна часть веревки создан.
Код: Выделить всё
using UnityEngine;
public class ThrowRope : MonoBehaviour
{
[SerializeField] private GameObject _hook;
[SerializeField] private GameObject _unitRopePref;
[SerializeField] private Transform _player;
void Update()
{
if (Button.nuberPerson == 2)
{
if (Cursorrender.cursRopeMode)
{
Ray ray = new Ray(transform.position, transform.forward);
RaycastHit hit;
Debug.DrawRay(ray.origin, ray.direction * 100, Color.red);
if (Input.GetMouseButtonUp(0))
{
Debug.Log("CLICK");
if (Physics.Raycast(ray, out hit))
{
Debug.Log("HIT");
if (hit.distance
Подробнее здесь: [url]https://stackoverflow.com/questions/79029417/no-bumps-on-the-object[/url]
Мобильная версия