Created
May 19, 2016 20:45
-
-
Save remusjones/1dfd28f013630a8c32ef1b0a7352fb17 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void OnParticleCollision(GameObject other) | |
| { | |
| ParticleSystem.Particle[] particles = new ParticleSystem.Particle[m_hitAnim.particleCount]; | |
| m_hitAnim.GetParticles(particles); | |
| ParticleCollisionEvent[] collEvent = new ParticleCollisionEvent[16]; | |
| // Keeps track of the amount of collision events | |
| int events = m_hitAnim.GetCollisionEvents(other, collEvent); | |
| for (int i = 0; i < collEvent.Length; i++) | |
| { | |
| Vector3 newIntersect = collEvent[i].intersection; | |
| if (newIntersect != (new Vector3(0, 0, 0))){ | |
| Debug.Log("Intestect at\t" + newIntersect); | |
| GameObject obj = Instantiate(Blood, new Vector3(newIntersect.x, 0.1f, newIntersect.z), Blood.transform.rotation) as GameObject; | |
| } | |
| } | |
| m_hitAnim.SetParticles(particles, particles.Length); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment