Question by
bathorsthroat · Jul 28, 2016 at 10:01 AM ·
transformplayerdirectionteleportingfacing
Teleport player facing gameobjects x direction
Hello I have my game set so that when the player enters a door the player then teleports to the transform position of and invisible cube. I want to figure out how to force the player to face in the same X direction as the invisible cube. Any ideas? Thanks.
function Start ()
{
}
function OnTriggerStay(Col : Collider)
{
if(Col.tag == "Player")
{
if(Input.GetKey(KeyCode.E))
{
col=Color(0,0,0,1);
fadeblack = false;
fPlayer.transform.position = nextRoom.position;
GetComponent.<AudioSource>().PlayOneShot(doorSound);
doorSoundPlay = true;
col=Color(0,0,0,1);
fadeblack = true;
yield WaitForSeconds (0.8);
fadeblack = false;
}
}
}
Comment