| | | 1 | | //======================================================================= |
| | | 2 | | // RagdollJointDefinition2D.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 joint entry for a deterministic pure 2D ragdoll articulation. |
| | | 12 | | /// </summary> |
| | | 13 | | public readonly struct RagdollJointDefinition2D |
| | | 14 | | { |
| | | 15 | | /// <summary> |
| | | 16 | | /// Creates a ragdoll joint definition with unrestricted limits, no motor, and adjacent self-collision suppression. |
| | | 17 | | /// </summary> |
| | | 18 | | public RagdollJointDefinition2D( |
| | | 19 | | int linkAId, |
| | | 20 | | int linkBId, |
| | | 21 | | JointType2D type, |
| | | 22 | | JointFrame2D localFrameA, |
| | | 23 | | JointFrame2D localFrameB) |
| | 27 | 24 | | : this( |
| | 27 | 25 | | linkAId, |
| | 27 | 26 | | linkBId, |
| | 27 | 27 | | type, |
| | 27 | 28 | | localFrameA, |
| | 27 | 29 | | localFrameB, |
| | 27 | 30 | | JointLimit2D.Unrestricted, |
| | 27 | 31 | | JointMotor2D.Disabled, |
| | 27 | 32 | | JointCollisionPolicy.SuppressLinked) |
| | | 33 | | { |
| | 27 | 34 | | } |
| | | 35 | | |
| | | 36 | | /// <summary> |
| | | 37 | | /// Creates a pure 2D ragdoll joint definition. |
| | | 38 | | /// </summary> |
| | | 39 | | public RagdollJointDefinition2D( |
| | | 40 | | int linkAId, |
| | | 41 | | int linkBId, |
| | | 42 | | JointType2D type, |
| | | 43 | | JointFrame2D localFrameA, |
| | | 44 | | JointFrame2D localFrameB, |
| | | 45 | | JointLimit2D limits, |
| | | 46 | | JointMotor2D motor, |
| | | 47 | | JointCollisionPolicy collisionPolicy) |
| | | 48 | | { |
| | 28 | 49 | | LinkAId = linkAId; |
| | 28 | 50 | | LinkBId = linkBId; |
| | 28 | 51 | | Type = type; |
| | 28 | 52 | | LocalFrameA = localFrameA; |
| | 28 | 53 | | LocalFrameB = localFrameB; |
| | 28 | 54 | | Limits = limits; |
| | 28 | 55 | | Motor = motor; |
| | 28 | 56 | | CollisionPolicy = collisionPolicy; |
| | 28 | 57 | | } |
| | | 58 | | |
| | | 59 | | /// <summary> |
| | | 60 | | /// Gets the first authored link ID. |
| | | 61 | | /// </summary> |
| | | 62 | | public int LinkAId { get; } |
| | | 63 | | |
| | | 64 | | /// <summary> |
| | | 65 | | /// Gets the second authored link ID. |
| | | 66 | | /// </summary> |
| | | 67 | | public int LinkBId { get; } |
| | | 68 | | |
| | | 69 | | /// <summary> |
| | | 70 | | /// Gets the joint type. |
| | | 71 | | /// </summary> |
| | | 72 | | public JointType2D Type { get; } |
| | | 73 | | |
| | | 74 | | /// <summary> |
| | | 75 | | /// Gets the local frame for the first link. |
| | | 76 | | /// </summary> |
| | | 77 | | public JointFrame2D LocalFrameA { get; } |
| | | 78 | | |
| | | 79 | | /// <summary> |
| | | 80 | | /// Gets the local frame for the second link. |
| | | 81 | | /// </summary> |
| | | 82 | | public JointFrame2D LocalFrameB { get; } |
| | | 83 | | |
| | | 84 | | /// <summary> |
| | | 85 | | /// Gets optional scalar limit data. |
| | | 86 | | /// </summary> |
| | | 87 | | public JointLimit2D Limits { get; } |
| | | 88 | | |
| | | 89 | | /// <summary> |
| | | 90 | | /// Gets optional scalar motor data. |
| | | 91 | | /// </summary> |
| | | 92 | | public JointMotor2D Motor { get; } |
| | | 93 | | |
| | | 94 | | /// <summary> |
| | | 95 | | /// Gets physical collision filtering behavior for the linked colliders. |
| | | 96 | | /// </summary> |
| | | 97 | | public JointCollisionPolicy CollisionPolicy { get; } |
| | | 98 | | } |