unity3d 3.5 如何检测粒子碰撞

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 03:01:52
unity3d3.5如何检测粒子碰撞unity3d3.5如何检测粒子碰撞unity3d3.5如何检测粒子碰撞首先给粒子加上WorldParticleCollider,然后勾上sendCollision

unity3d 3.5 如何检测粒子碰撞
unity3d 3.5 如何检测粒子碰撞

unity3d 3.5 如何检测粒子碰撞
首先给粒子加上World Particle Collider,然后勾上sendCollisionMessage
然后用function OnParticleCollision (other :GameObject)
{ var body :Rigidbody = other.rigidbody; if (body) { var direction :Vector3 = other.transform.position - transform.position; direction = direction.normalized; body.AddForce (direction * 5); }}
接受碰撞信息,要注意的是,被粒子碰撞的物体需要加collider