【发布时间】:2020-02-15 21:49:46
【问题描述】:
所以我在我的播放器上安装了这个小粒子系统,所以如果他死了,他就会爆炸。但我不能简单地将粒子系统附加到玩家下方,因为如果我摧毁我的玩家,游戏对象的孩子也会被摧毁。如果他死了,动画就会运行,但不是在他现在的位置,所以有什么想法吗?也许在玩家死亡时将位置转换为玩家的当前位置? 这是我的代码:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playerdeath : MonoBehaviour
{
public ParticleSystem death_explosion;
// Start is called before the first frame update
void Start()
{
death_explosion.Stop();
}
// Update is called once per frame
void Update()
{
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "deathcube")
Destroy(gameObject);
Debug.Log("collision detected");
death_explosion.Play();
}
}
【问题讨论】:
-
所以,在玩家位置实例化粒子
-
怎么^^=? :=)
标签: c# unity3d collision-detection particles particle-system