[Diving] Movement with a rock and 3 ropes is working
This commit is contained in:
40
Assets/External/OptimizedRopesAndCables/Example/Scripts/CameraMove.cs
vendored
Normal file
40
Assets/External/OptimizedRopesAndCables/Example/Scripts/CameraMove.cs
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GogoGaga.OptimizedRopesAndCables
|
||||
{
|
||||
public class CameraMove : MonoBehaviour
|
||||
{
|
||||
public float speed = 15;
|
||||
public Transform[] cameraPoses;
|
||||
int current = 0;
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
transform.position = Vector3.Lerp(transform.position, cameraPoses[current].position, Time.deltaTime * speed);
|
||||
transform.rotation = Quaternion.Lerp(transform.rotation, cameraPoses[current].rotation, Time.deltaTime * speed);
|
||||
|
||||
if (Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.Q))
|
||||
{
|
||||
current--;
|
||||
if (current == -1)
|
||||
current = cameraPoses.Length -1;
|
||||
}
|
||||
else if (Input.GetMouseButtonDown(1) || Input.GetKeyDown(KeyCode.E))
|
||||
{
|
||||
current++;
|
||||
if (current == cameraPoses.Length)
|
||||
current = 0;
|
||||
}
|
||||
|
||||
current = Mathf.Clamp(current, 0, cameraPoses.Length - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Assets/External/OptimizedRopesAndCables/Example/Scripts/CameraMove.cs.meta
vendored
Normal file
18
Assets/External/OptimizedRopesAndCables/Example/Scripts/CameraMove.cs.meta
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d660d0789910d645b229029d11c4dd1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287164
|
||||
packageName: Optimized Ropes And Cables Tool
|
||||
packageVersion: 1.2
|
||||
assetPath: Assets/GogoGaga/OptimizedRopesAndCables/Example/Scripts/CameraMove.cs
|
||||
uploadId: 683666
|
||||
47
Assets/External/OptimizedRopesAndCables/Example/Scripts/PointsAssignExample.cs
vendored
Normal file
47
Assets/External/OptimizedRopesAndCables/Example/Scripts/PointsAssignExample.cs
vendored
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Assets/External/OptimizedRopesAndCables/Example/Scripts/PointsAssignExample.cs.meta
vendored
Normal file
18
Assets/External/OptimizedRopesAndCables/Example/Scripts/PointsAssignExample.cs.meta
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09364bec8d9530244b2da7af704cecf5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287164
|
||||
packageName: Optimized Ropes And Cables Tool
|
||||
packageVersion: 1.2
|
||||
assetPath: Assets/GogoGaga/OptimizedRopesAndCables/Example/Scripts/PointsAssignExample.cs
|
||||
uploadId: 683666
|
||||
Reference in New Issue
Block a user