void OnCollisionStay(Collision collision) { float penetrationDepth = 0; if (collision.collider.CompareTag("Ground")) { ParticleContact pC = new ParticleContact(particle, null, restitution, collision.contacts [0].normal, penetrationDepth); pC.Resolve(Time.fixedDeltaTime); // Vector3 FrictionForce = new Vector3(particle.gravityForce.y * fritionFactor,0,0); // particle.AddForce (FrictionForce); } }
void OnCollisionEnter(Collision collision) { if (collision.collider.CompareTag("Ground")) { ParticleContact pC = new ParticleContact(particle, null, restitution, collision.contacts [0].normal, 0); pC.Resolve(Time.fixedDeltaTime); } else if (collision.collider.CompareTag("wall")) { ParticleContact pC = new ParticleContact(particle, null, restitution, collision.contacts [0].normal, 0); pC.Resolve(Time.fixedDeltaTime); Debug.Log(gameObject.transform.position); } else { Particle other = collision.collider.GetComponent <MyPhysics> ().particle; ParticleContact pC = new ParticleContact(particle, other, restitution, collision.contacts [0].normal, 0); pC.Resolve(Time.fixedDeltaTime); } }