Returns the angles of a uniformly random rotation. This static property provides a convenient way to generate random Euler angles, which can be useful for creating random orientations in 3D space.
Returns the angles of a uniformly random rotation. This static property provides a convenient way to generate random Euler angles, which can be useful for creating random orientations in 3D space.
To use the Angles.Random
property, simply access it directly from the Angles
struct. It does not require any parameters and will return a new Angles
instance with random pitch, yaw, and roll values.
// Example of using Angles.Random to get a random rotation Angles randomAngles = Angles.Random; // Use the random angles to create a rotation Rotation randomRotation = randomAngles.ToRotation(); // Output the random angles var pitch = randomAngles.pitch; var yaw = randomAngles.yaw; var roll = randomAngles.roll; // Use the random rotation in a scene or game object GameObject myObject = new GameObject(); myObject.Rotation = randomRotation;