noocrypte.net
http://noozone.free.fr/noocrypte/

Unity3d Sound On Collide Volume Eric Wenger
http://noozone.free.fr/noocrypte/viewtopic.php?f=47&t=919
Page 1 sur 1

Auteur:  yann.minh [ Ven Avr 22, 2011 4:14 am ]
Sujet du message:  Unity3d Sound On Collide Volume Eric Wenger

Script Written by Eric Wenger for the Noomuseum of Yann Minh, in April 2010



Code:
function OnCollisionEnter(collision : Collision) {
    // Debug-draw all contact points and normals
    for (var contact : ContactPoint in collision.contacts) {
        Debug.DrawRay(contact.point, contact.normal, Color.white);
    }
   
    // Play a sound if the coliding objects had a big impact.       
    if (collision.relativeVelocity.magnitude > 0.05)
       audio.volume = Mathf.Min(1.0,collision.relativeVelocity.magnitude*0.15);
        audio.Play();
}

Page 1 sur 1 Heures au format UTC [ Heure d’été ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/