小时候给向上移动的主相机制作了雨粒子效果,但雨效果并不完美,因为它向北移动
Made a rain particle effect as a child to main camera which moves upwards but the rain effect is not perfect since its moving north
我在 unity 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;
}
}
所以按照@ARutherford 所说将模拟 Space 更改为世界应该可以解决问题
我在 unity 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;
}
}
所以按照@ARutherford 所说将模拟 Space 更改为世界应该可以解决问题