Hi - when my third person controller hits a collider, he is destroyed, and a new third person controller is instantiated in the exact same position.
However - I also want him to be rotated 180 degrees (so facing backwards).
This is the line of code that is giving me an error: carl.transform.Rotate (0, 180, 0);
Do you know what I’m doing wrong?
This is the script to instantiate a new third person controller (JavaScript):
var carl : GameObject;
var vincentCamera : GameObject;
var thirdPerson : GameObject;
var script : SwitchCharacters;
var playerGO : GameObject;
private var hasPlayed = false;
var characterPosition : Vector3;
function Start () {
carl.SetActive (false);
vincentCamera.SetActive (false);
}
function OnTriggerEnter () {
if (!hasPlayed&&!thirdPerson.active){
characterPosition = GetComponent(DestroyCharacter).firstCharacterPosition;
carl.transform.position = characterPosition;
carl.transform.Rotate (0, 180, 0);
carl.SetActive (true);
vincentCamera.SetActive (true);
script.cam02 = carl.Find("VincentCamera");
script = playerGO.GetComponent(SwitchCharacters);
script.player02 = carl;
hasPlayed = true;
}
Any help on how to fix the error would be so much appreciated!
The error is BCE0077: It is not possible to invoke an expression of type ‘UnityEngine.Quaternion’.
Thanks, Laurien