Files
MetalGear2D.Unity/Assets/Scripts/Rope.cs
T

40 lines
622 B
C#
Raw Normal View History

2025-05-13 05:19:58 +03:00
using UnityEngine;
using System.Collections;
public class Rope : MonoBehaviour {
public HingeJoint2D[] objects;
bool isfixed = false;
int fixCount = 0;
// Use this for initialization
void Start () {
//Invoke("Fix", Time.time);
//
}
void Fix(){
foreach(var j in objects){
j.useMotor = true;
JointMotor2D m = new JointMotor2D();
m.maxMotorTorque = 0;
m.motorSpeed = 0;
j.motor = m;
j.useMotor = false;
j.enabled = true;
}
}
void FixedUpdate(){
if(fixCount < 10){
Fix();
isfixed = true;
fixCount++;
}
}
// Update is called once per frame
void Update () {
}
}