Is there anyone know how to rotate The FPS Char from standard asset. Somehow i want to rotate it at Start function, but it didn’t work, thank you
This may be a tad buggy? Not sure haven’t tested it, but this would go in Start() or Awake(). And basically tells the transform, or the gameObject that has this code:
if Vector3 == 1,0,-1 rotate southeast I think?
Vector3 randomRotation = new Vector3(Random.Range(-1,1), 0, Random.Range(-1,1));
transform.Rotate (randomRotation);
You might have to play with it a little bit
Thanks again WideEyeNow, so my code:
gameObject.transform.localEulerAngles = new Vector3(0, Random.Range(0, 360), 0);
(i use array to specify some angle and random it) and your code:
Vector3 randomRotation = new Vector3(0, Random.Range(0, 360), 0);
transform.Rotate(randomRotation);
are actually working. I find out that my mistake is I put it on the FPS Controller script. (Shouldn’t it has to be working too?). So I create new script with the code, attach to the FPS char and it’s working now. Thanks again WideEyeNow for the reply. Really appreciate that.