Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


PhysicsRotate

Represents a 2D rotation.
Read time 2 minutesLast updated 9 days ago

Definition

public struct PhysicsRotate : ISerializationCallbackReceiver

Fields

Value

Description

directionThe rotation direction where X = cos(angle) and Y = sin(angle). This should always be normalized otherwise warnings will be produced when used, however this is not enforced. See PhysicsRotate.isNormalized and PhysicsRotate.Normalized.

Constructors

Constructor

Description

PhysicsRotate()Create an identity rotation.
PhysicsRotate(System.Single)Create a rotation with the specified angle.
PhysicsRotate(UnityEngine.Quaternion,UnityEngine.LowLevelPhysics2D.PhysicsWorld.TransformPlane)Create a rotation with the specified Quaternion.
PhysicsRotate(UnityEngine.Vector2)Create a rotation with the specified direction.

Properties

Property

Description

angleGet the angle which this rotation represents, in radians.
cosThe cosine of the rotation angle.
isNormalizedIs the rotation normalized? If not, it should be normalized using PhysicsRotate.Normalized.
isValidCheck if the rotation is valid (not NaN and Normalized).
sinThe sine of the rotation angle.

Static Properties

Property

Description

downA rotation of -PI/2 Radians (-90 Degrees or +270 Degrees).
identityThe identity rotation i.e. no rotation.
leftA rotation of +PI Radians (+/- 180 Degrees).
rightA rotation of zero Radians. This is the same as identity. See PhysicsRotate.identity.
upA rotation of +PI/2 Radians (+90 Degrees).

Methods

Method

Description

AngularVelocityCalculate the angular velocity necessary to rotate the current rotation and the specified rotation over a give time.
GetMatrixCalculate a rotation Matrix4x4 using the specified transform plane.
GetRelativeAngleGet the relative angle between this rotation and the specified rotation. The limits of this are +/- PhysicsMath.PI.
IntegrateRotationIntegrate the rotation using the specified angle change.
InverseMultiplyRotationInverse Multiply a rotation with this rotation.
InverseRotateVectorInverse Rotate a vector.
LerpRotationCalculate the normalized linear interpolation of this rotation and the specified rotation using the specified interval.
MultiplyRotationMultiply a rotation with this rotation.
NormalizedCreate a normalized rotation.
RotateRotate the rotation by the specified angle.
RotateVectorRotate a vector.

Static Methods

Method

Description

AngularVelocityCalculate the angular velocity necessary to rotate between two rotations over a give time.
LerpRotationCalculate the normalized linear interpolation between two rotations using the specified fraction.
UnwindAngleConvert any angle into the range [-pi, pi].