| | | 1 | | //======================================================================= |
| | | 2 | | // JointFrame2D.cs |
| | | 3 | | //======================================================================= |
| | | 4 | | // MIT License, Copyright (c) 2026-present David Oravsky (mrdav30) |
| | | 5 | | // See LICENSE file in the project root for full license information. |
| | | 6 | | //======================================================================= |
| | | 7 | | |
| | | 8 | | using FixedMathSharp; |
| | | 9 | | |
| | | 10 | | namespace Gravitas.Constraints; |
| | | 11 | | |
| | | 12 | | /// <summary> |
| | | 13 | | /// Immutable local anchor frame used by a pure 2D joint. |
| | | 14 | | /// </summary> |
| | | 15 | | public readonly struct JointFrame2D |
| | | 16 | | { |
| | | 17 | | /// <summary> |
| | | 18 | | /// Creates a local planar joint frame. |
| | | 19 | | /// </summary> |
| | | 20 | | public JointFrame2D(Vector2d anchor, Fixed64 angle) |
| | | 21 | | { |
| | 60 | 22 | | Anchor = anchor; |
| | 60 | 23 | | Angle = angle; |
| | 60 | 24 | | } |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// Gets the body-local anchor point in the X/Z simulation plane. |
| | | 28 | | /// </summary> |
| | | 29 | | public Vector2d Anchor { get; } |
| | | 30 | | |
| | | 31 | | /// <summary> |
| | | 32 | | /// Gets the body-local scalar frame angle in radians. |
| | | 33 | | /// </summary> |
| | | 34 | | public Fixed64 Angle { get; } |
| | | 35 | | |
| | | 36 | | /// <summary> |
| | | 37 | | /// Gets the identity local frame. |
| | | 38 | | /// </summary> |
| | 366 | 39 | | public static JointFrame2D Identity => default; |
| | | 40 | | } |