| | | 1 | | //======================================================================= |
| | | 2 | | // JointDefinition2D.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 | | namespace Gravitas.Constraints; |
| | | 9 | | |
| | | 10 | | /// <summary> |
| | | 11 | | /// Authored payload used to register one context-owned deterministic pure 2D joint. |
| | | 12 | | /// </summary> |
| | | 13 | | public readonly struct JointDefinition2D |
| | | 14 | | { |
| | | 15 | | /// <summary> |
| | | 16 | | /// Creates a pure 2D joint definition. |
| | | 17 | | /// </summary> |
| | | 18 | | public JointDefinition2D( |
| | | 19 | | SolidBody2D bodyA, |
| | | 20 | | SolidBody2D bodyB, |
| | | 21 | | JointFrame2D localFrameA, |
| | | 22 | | JointFrame2D localFrameB, |
| | | 23 | | JointType2D type, |
| | | 24 | | JointLimit2D limits, |
| | | 25 | | JointMotor2D motor, |
| | | 26 | | JointCollisionPolicy collisionPolicy) |
| | | 27 | | { |
| | 225 | 28 | | BodyA = bodyA; |
| | 225 | 29 | | BodyB = bodyB; |
| | 225 | 30 | | LocalFrameA = localFrameA; |
| | 225 | 31 | | LocalFrameB = localFrameB; |
| | 225 | 32 | | Type = type; |
| | 225 | 33 | | Limits = limits; |
| | 225 | 34 | | Motor = motor; |
| | 225 | 35 | | CollisionPolicy = collisionPolicy; |
| | 225 | 36 | | } |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// Gets the first body linked by the joint. |
| | | 40 | | /// </summary> |
| | | 41 | | public SolidBody2D BodyA { get; } |
| | | 42 | | |
| | | 43 | | /// <summary> |
| | | 44 | | /// Gets the second body linked by the joint. |
| | | 45 | | /// </summary> |
| | | 46 | | public SolidBody2D BodyB { get; } |
| | | 47 | | |
| | | 48 | | /// <summary> |
| | | 49 | | /// Gets the first local anchor frame. Values are copied at registration time. |
| | | 50 | | /// </summary> |
| | | 51 | | public JointFrame2D LocalFrameA { get; } |
| | | 52 | | |
| | | 53 | | /// <summary> |
| | | 54 | | /// Gets the second local anchor frame. Values are copied at registration time. |
| | | 55 | | /// </summary> |
| | | 56 | | public JointFrame2D LocalFrameB { get; } |
| | | 57 | | |
| | | 58 | | /// <summary> |
| | | 59 | | /// Gets the joint type. |
| | | 60 | | /// </summary> |
| | | 61 | | public JointType2D Type { get; } |
| | | 62 | | |
| | | 63 | | /// <summary> |
| | | 64 | | /// Gets optional scalar limit data. |
| | | 65 | | /// </summary> |
| | | 66 | | public JointLimit2D Limits { get; } |
| | | 67 | | |
| | | 68 | | /// <summary> |
| | | 69 | | /// Gets optional scalar motor data. |
| | | 70 | | /// </summary> |
| | | 71 | | public JointMotor2D Motor { get; } |
| | | 72 | | |
| | | 73 | | /// <summary> |
| | | 74 | | /// Gets physical collision filtering behavior for the linked colliders. |
| | | 75 | | /// </summary> |
| | | 76 | | public JointCollisionPolicy CollisionPolicy { get; } |
| | | 77 | | } |