Question by
Romero Geschieir · Nov 27, 2015 at 09:33 AM ·
scripting problemteleportclick objects
How do I teleport my character when clicking a certain object Help )::
So this is my whole script, as you can see I already have my player teleporting when enters a trigger, however, this time I need it to teleport when clicking an onject. this script is attached to the player itself, and I tagged the object as "Dead" and attached target where I wanted my player to be teleported, Sadly ); the one of the mouse down doesnt work , nothing happens when I click my object. I tried as well the other way round so I put the on mouse down in the object itself, but I didn't know how to call the player.
pragma strict
var target : Transform; var target2 : Transform; var target3 : Transform;
function Update () {
}
function OnTriggerEnter (col : Collider) {
if(col.gameObject.tag == "Dead") {
this.transform.position = target.position;
}
if(col.gameObject.tag == "Dead2") {
this.transform.position = target2.position;
}
if (Input.GetMouseButtonDown(0))
{
if(gameObject.tag == "Dead")
{
this.transform.position = target.position;
}
}
}
Comment