Я создал систему частиц дождя в единице 2d и прикрепил ее в детстве к основной камере, чтобы она могла двигаться вместе с камерой на север.но эффект дождя не идеален, поскольку некоторые частицы колеблются вверх.Я прикрепил скрипт к камере, который приведен ниже.Есть ли другой способ решить эту проблему.
public float translation ;
public float highspeed;//highest speed of the camera
public float incfactor;//increasing ,multiplying number
float timer=0f ;
public bool ismoving = false;
Rigidbody2D dia;
void Start()
{
dia = GetComponent<Rigidbody2D> ();
}
void Update()
{
if (Input.GetMouseButtonDown(0)) {
RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
if(hit.collider != null) {
if (hit.collider.tag =="dialogue") {
FindObjectOfType<audioManager> ().Play ("levelbeginclick");
Destroy (hit.collider.gameObject);
ismoving = true;
}
}
}
if (ismoving == true) {
Updatemove ();
}
}
public void Updatemove ()
{
timer += Time.deltaTime;
if (timer > 1f&& translation<highspeed) {
timer = 0; // reset timer
translation +=incfactor ;
}
transform.Translate (0, translation*Time.deltaTime, 0);
}
public void stopmoving()
{
ismoving = false;
}
}