OnCollideSound

From Unify Community Wiki
Revision as of 12:11, 8 November 2007 by Opless (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Author: Opless

Description

Simple Prefab spawning collision, great for collision sounds

CSharp - OnCollideSound.cs

<csharp> using UnityEngine; using System.Collections;

public class OnCollideSound : MonoBehaviour {

public GameObject collisionSoundPrefab; public float triggerMagnitude = 2;

void OnCollisionEnter( Collision collision ) { if (collision.relativeVelocity.magnitude > triggerMagnitude) Instantiate(collisionSoundPrefab, this.transform.position, this.transform.rotation); }

} </csharp>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox