Unity 3D Turn Gravity On Off Tutorial20154

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

Disclaimer: Gambar, artikel ataupun video yang ada di web ini terkadang berasal dari berbagai sumber media lain. Hak Cipta sepenuhnya dipegang oleh sumber tersebut. Jika ada masalah terkait hal ini, Anda dapat menghubungi kami disini.

Tidak ada komentar:

Posting Komentar

© Copyright 2017 Tutorial Unity 3D