Hi - when my first person controller hits a collider I want to transform his position, and also set his rotation so he is facing a specific part of the scene.
As far as I can tell, I should be using Space.World, so I set the player’s rotation in world space rather than in local space - but when I attached this script to a collider the player only transforms position, but not rotation.
Does anyone have any ideas on how to to fix this, so that I can give the player a set rotation, rather than a rotation which is different depending on the angle the player happened to be on hitting the collider?
var player : GameObject;
var posx : float;
var posz : float;
//var pos : Vector3 = transform.position;
function OnTriggerEnter(other: Collider){
if(other.gameObject.tag == "Player") {
player.transform.Rotate(0,180,0, Space.World);
player.transform.position = Vector3(posx,-2.6,posz);
}
}
All the best, Laurien