- 最后登录
- 2019-12-25
- 注册时间
- 2012-8-24
- 阅读权限
- 90
- 积分
- 71088
 
- 纳金币
- 52360
- 精华
- 343
|
鼠标点击一个物体 物体周围出现一个圈- using UnityEngine;
- using System.Collections;
- using UnityEditor;
- public class css : MonoBehaviour
- {
- private GameObject s;
- private GameObject no;
- void Start()
- {
- }
- void Update()
- {
- test_s();
- }
- void test_s()
- {
- if (no == null)
- {
- if (Input.GetMouseButtonDown(0))
- {
- for (int i = 0; i < Selection.gameObjects.Length; i++)
- {
- s = GameObject.CreatePrimitive(PrimitiveType.Cube);
- no = Selection.gameObjects[i];
- s.AddComponent<TrailRenderer>();
- s.transform.position = new Vector3(Selection.gameObjects[i].transform.position.x, Selection.gameObjects[i].transform.position.y + 10f, Selection.gameObjects[i].transform.position.z);
- }
- }
- else
- return;
- }
- else
- {
- for (int i = 0; i < Selection.gameObjects.Length; i++)
- s.transform.RotateAround(no.transform.position, new Vector3(0,0,10), 2000 * Time.deltaTime);
- }
- }
-
- }
复制代码 |
|