[Diving] Movement with a rock and 3 ropes is working

This commit is contained in:
Michal Pikulski
2025-09-04 23:13:19 +02:00
parent d34eb77e20
commit fbb658098b
110 changed files with 28707 additions and 4 deletions

View File

@@ -0,0 +1,47 @@
using UnityEngine;
namespace GogoGaga.OptimizedRopesAndCables
{
public class PointsAssignExample : MonoBehaviour
{
[SerializeField] private Transform point1;
[SerializeField] private Transform point2;
[SerializeField] private Rope rope;
void Update()
{
if (Input.GetKeyDown(KeyCode.Alpha1))
{
//Assigning new end point to the rope with animation
rope.SetEndPoint(point1);
}
if (Input.GetKeyDown(KeyCode.Alpha2))
{
//Assigning new end point to the rope with animation
rope.SetEndPoint(point2);
}
if (Input.GetKeyDown(KeyCode.Alpha3))
{
//Assigning new end point to the rope without animation
//The rope will be recalculated immediately
rope.SetEndPoint(point1, true);
}
if (Input.GetKeyDown(KeyCode.Alpha4))
{
//Assigning new end point to the rope without animation
//The rope will be recalculated immediately
rope.SetEndPoint(point2, true);
}
if (Input.GetKeyDown(KeyCode.Alpha5))
{
//Removing end point from the rope, the rope will be
//recalculated, LineRenderer will be cleared
rope.SetEndPoint(null);
}
}
}
}