PhysicsRotate
Represents a 2D rotation.
Read time 2 minutesLast updated 11 days ago
Definition
- Type: Struct
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
- Implements: ISerializationCallbackReceiver
public struct PhysicsRotate : ISerializationCallbackReceiver
Fields
Value | Description |
|---|---|
| direction | The rotation direction where X = cos(rotation) and Y = sin(rotation). This should always be normalized otherwise warnings will be produced when used, however this is not enforced. See _isNormalized and PhysicsRotate.Normalized. |
Constructors
Constructor | Description |
|---|---|
| PhysicsRotate() | Create an identity rotation. |
| PhysicsRotate(UnityEngine.Quaternion,Unity.U2D.Physics.PhysicsWorld.TransformPlane) | Create a rotation with the specified Quaternion. |
| PhysicsRotate(UnityEngine.Vector2) | Create a rotation with the specified direction. |
Properties
Property | Description |
|---|---|
| cos | The cosine of the rotation angle. |
| degrees | Get the rotation, in degrees. |
| isNormalized | Is the rotation normalized? If not, it should be normalized using PhysicsRotate.Normalized. |
| isValid | Check if the rotation is valid (not NaN and Normalized). |
| radians | Get the rotation, in radians. |
| sin | The sine of the rotation angle. |
Static Properties
Property | Description |
|---|---|
| down | A rotation of -PI/2 Radians (-90 Degrees or +270 Degrees). |
| identity | The identity rotation i.e. no rotation. |
| left | A rotation of +PI Radians (+/- 180 Degrees). |
| right | A rotation of zero Radians. This is the same as identity. See _identity. |
| up | A rotation of +PI/2 Radians (+90 Degrees). |
Methods
Method | Description |
|---|---|
| AngularVelocity | Calculate the angular velocity necessary to rotate the current rotation and the specified rotation over a give time. |
| GetMatrix | Calculate a rotation Matrix4x4 using the specified transform plane. |
| GetRelativeAngle | Get the relative angle between this rotation and the specified rotation. The limits of this are +/- PhysicsMath.PI. |
| IntegrateRotation | Integrate the rotation using the specified angle change. |
| Inverse | Calculate a new inverse rotation of the current rotation. |
| InverseMultiplyRotation | Inverse Multiply a rotation with this rotation. |
| InverseRotateVector | Inverse Rotate a vector. |
| LerpRotation | Calculate the normalized linear interpolation of this rotation and the specified rotation using the specified interval. |
| MultiplyRotation | Multiply a rotation with this rotation. |
| Normalized | Create a normalized rotation. |
| Rotate | Calculate a new rotation of the current rotation by the specified angle. |
| RotateVector | Rotate a vector. |
Static Methods
Method | Description |
|---|---|
| AngularVelocity | Calculate the angular velocity necessary to rotate between two rotations over a give time. |
| FromDegrees | Create a rotation with the specified rotation, in degrees. |
| FromRadians | Create a rotation with the specified rotation, in radians. |
| LerpRotation | Calculate the normalized linear interpolation between two rotations using the specified fraction. |
| UnwindAngle | Convert any angle into the range [-pi, pi]. |