Saturday, 4 April 2015

Unity3d Tutorial Slow Motion

Unity3d Tutorial Slow Motion

Easter video series !










THIS IS Java# script: GOOD 4 2D GAMES AND 3D GAMES !
----------------------------------------­­­­­­­----------------------------------­-­-­-­-­-­-­------

DIRECT DOWNLOAD HERE




THIS IS BACKUP  IN TEXT FORM  TUTORIAL SlowMotion

1. Create New java and name it : SlowMotion


2. Copy & Past this text and save java :
----------------------------------------­­­­­------------------------------------­-­-­-­-­-


var slowMoIn : AudioClip;
var slowMoOut : AudioClip;   
   
function Update(){
if (Input.GetKeyDown (KeyCode.S)) {
if (Time.timeScale == 1.0){ 
Time.timeScale = 0.3;
}else{
Time.timeScale = 1.0;
Time.fixedDeltaTime = 0.02 * Time.timeScale;
}
var aSources = FindObjectsOfType(AudioSource);
for (aSource in aSources)
aSource.pitch = Time.timeScale;
if (Time.timeScale == 1.0) PlayAudioClip(slowMoOut, transform.position, 1.0);
else PlayAudioClip(slowMoIn, transform.position, 1.0);
    }
}

function PlayAudioClip (clip : AudioClip, position : Vector3, volume : float) {
    var go = new GameObject ("One shot audio");
    go.transform.position = position;
    var source : AudioSource = go.AddComponent (AudioSource);
    source.clip = clip;
    source.volume = volume;
source.pitch = 1.0;
    source.Play ();
    Destroy (go, clip.length);
    return source;
}







 ----------------------------------------­­­­­------------------------------------­-­-­-­-­-

0 comments:

Post a Comment