Advertisemen
Unity3D Tutorial: 19 Move object when player reach trigger!
Unity3D Tutorial: 19 Move object Platform,Object or whatever you need when player reach trigger
NO ANIMATION REQUIRED It's all done by a very simple script.
THIS IS Java scrip: GOOD 4 2D GAMES AND 3D GAMES !
DIRECT DOWNLOAD HERE
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
THIS IS BACKUP IN TEXT FORM TUTORIAL 19
1. Create New java and name it : PlatformA1
2. Copy & Past this text and save java :
var target : Transform;
var target2 : Transform;
var smooth = 0.5;
var Move = false;
function Update()
{
if(Move == true)
transform.position = Vector3.Lerp (transform.position, target.position, Time.deltaTime * smooth);
else
transform.position = Vector3.Lerp (transform.position, target2.position, Time.deltaTime * smooth);
}
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
THIS IS BACKUP IN TEXT FORM TUTORIAL 19
1. Create New java and name it : TreagerPlatformA1
2. Copy & Past this text and save java :
#pragma strict
var Player : GameObject;
function OnTriggerEnter(other : Collider) //Check if something has entered the trigger ( and declares this object in "other" )
{
if(other.collider.tag == Player.tag) //Checks if the Player is inside the trigger
{
GameObject.Find("PLATFORM").GetComponent(PlatformA1).enabled = true;
}
}
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
Advertisemen
Tidak ada komentar:
Posting Komentar