*
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
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 () {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user