Problem with rotating one axis with range?

ShootFrom.transform.rotation.y = Random.Range(0.1F, 1);

That doesn’t work it will exceed the Range values givin , and it rotates all axis’. How would I make this work?
l

I've searched, still no solution, dang

errr okay........

transform.rotation is a quaternion. it's x,z,y are not representing coordinates. try transform.rotation = Quaternion.Euler(0, Random.Range(angle), 0);

"Uknown identifier " ANgle".

Errors.....

1 Answer

1

you have to declare angle. it’s the angle you wanna rotate (and it should be in degrees) like

var angle : float = Random.Range(0,90);
ShootFrom.transform.rotation = Quaternion.Euler(0, angle, 0);

it should rotate your object on the y with a random value between 0 and 90 degrees…