Advertisemen
Unity3D Creating a Camera Shake Effect Like Earthquake Tutorial 11
THIS IS Java scrip: GOOD 4 2D GAMES AND 3D GAMES !
-------------------------------------------------------------------------------------------------------------------------------------------------------
THIS IS Java scrip: Script num 1 : ( ShakeCam ) name your Scrpt : ShakeCam and copy past text !
-------------------------------------------------------------------------------------------------------------------------------------------------------
var ObjToShake : Transform;
function Update() {
var randNrX = Random.Range(0.7,-0.7);
var randNrY = Random.Range(0.7,-0.7);
var randNrZ = Random.Range(0.7,-0.7);
ObjToShake.transform.position += Vector3(randNrX,randNrY,randNrZ);
}
-------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------
THIS IS Java scrip: Script num 2 :( ShakeCamTrigger ) name your Scrpt: ShakeCamTrigger and copy past text
-------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma strict
var DragCamShakeEfectHere : GameObject;
function Start ()
{
DragCamShakeEfectHere.GetComponent.<ShakeCam>().enabled = false;
}
function OnTriggerEnter (col : Collider)
{
if (col.tag == "Player")
{
DragCamShakeEfectHere.GetComponent.<ShakeCam>().enabled = true;
}
}
function OnTriggerExit ()
{
DragCamShakeEfectHere.GetComponent.<ShakeCam>().enabled = false;
}
-------------------------------------------------------------------------------------------------------------------------------------------------------
Or Download here 2 Scripts
Text script in this blogg post is Backup
Download link DOWNLOAD NOW
Advertisemen
Tidak ada komentar:
Posting Komentar