OnCollideSound

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: Category: MonoBehaviour Category: CSharp Category: ReallySimpleScripts Author: Opless == Description == Simple Prefab spawning collision, great for collision sounds == CSha...)
 
Line 1: Line 1:
 
[[Category: MonoBehaviour]]
 
[[Category: MonoBehaviour]]
[[Category: CSharp]]
+
[[Category: C Sharp]]
 
[[Category: ReallySimpleScripts]]
 
[[Category: ReallySimpleScripts]]
  

Revision as of 13:54, 8 November 2007


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