Advertisemen
Unity 3D Turn Gravity On Off Tutorial20154
DIRECT DOWNLOAD HERE
THIS IS BACKUP IN TEXT FORM Tutorial20154
1. Create New C# and name it : TurnGravityOnOff
2. Copy & Past this text and save C# :
---------------------------------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine;
using System.Collections;
public class TurnGravityOnOff : MonoBehaviour {
void OnTriggerEnter(Collider other) {
if (other.tag == "Player"){ // if player entered the trigger...
rigidbody.useGravity = true; // turn gravity on
rigidbody.isKinematic = false;// turn kinematic off
audio.PlayOneShot(audio.clip, 1.0f); // if player entered the trigger play audio...
Destroy(gameObject, 5.0f); // if player entered the trigger destroy after 5 sec...
}
}
}
---------------------------------------------------------------------------------
Advertisemen
Tidak ada komentar:
Posting Komentar