《Unity HingeJoint的简单运用,门》 有两行代码现在已经用不了改了一下 有兴趣的朋友可以看一下啊 原作者原谅我啊

xiaoxiao2021-02-28  45

using System; using UnityEngine; using System.Collections; public class Test : MonoBehaviour {     private float OpenSpeed = 30;     private string option = "";     private bool isOpen = false;     static JointMotor motor;     // Use this for initialization      void Start()     {     }     // Update is called once per frame      void Update()     {         if (!isOpen)         {             option = "打开";         }         else         {             option = "关闭";         }     }     private void OnGUI()     {         if (GUI.Button(new Rect(10, 10, 200, 30), option))         {             motor = new JointMotor();             motor.targetVelocity = OpenSpeed;             motor.force = 3;             GetComponent<HingeJoint>().motor = motor;               OpenSpeed = -OpenSpeed;             isOpen = true;         }     } }
转载请注明原文地址: https://www.6miu.com/read-2628647.html

最新回复(0)