2017-08-04 104 views
-3

如何给触摸位置粒子系统, 我需要的粒子系统遵循触摸移动触摸位置,如何给粒子系统

请告诉我的东西

这个脚本连接粒子系统的

void Update() { 
    transform.position = new Vector2 (Input.GetTouch (0).position.x, Input.GetTouch (0).position.y); 
} 
+1

阅读“如何提出问题”,欢迎来到Stack Overflow –

+0

好的,那是错的? – Abs3akt

+0

写你已经尝试过或更多的细节.... –

回答

2
Camera cam = Camera.Main; 
    void Update() 
    { 
     if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved) 
     { 
      Vector2 touchPos = Input.GetTouch(0).Position; 
      transform.position = cam.ScreenToWorldPoint(new Vector3(touchPos.x, touchPos.y, 0)); 
     } 
    } 

这个工作更好吗?

+0

我用这个鳕'空隙更新(){ \t \t如果(Input.touchCount> 0){ \t \t \t如果(Input.touches [0]。相== TouchPhase.Moved){ \t \t \t \t \t \t \t \t Vector3 pos = Camera.main.ScreenToWorldPoint(Input.touches [0] .position); \t \t \t \t \t \t \t \t pos.z = transform.position.z; \t \t \t \t transform.position = pos; \t \t \t} \t \t}' – Abs3akt