Wednesday, 28 December 2016

Unity Move Object When Key Enter Trigger

Unity Move Object When Key Enter Trigger










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





#pragma strict

 public var _moveposition : Transform;
 public var speed : float;
 function OnTriggerStay (other:Collider)
{
    if (other.gameObject.tag == "PUT YOUR KEY TAG NAME HERE")
    {
 transform.position= Vector3.Lerp(transform.position,_moveposition.position, Time.deltaTime * speed);
}
}







0 comments:

Post a Comment