Skip to content

Commit 21a1118

Browse files
committed
Added APIExtension to the Snippets project.
1 parent 194cd82 commit 21a1118

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

LowLevel/Projects/Snippets/Assets/Examples/SuggestedAPI/PhysicsAPIExtensions.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,20 @@ public static PhysicsQuery.DistanceResult ShapeDistance(this PhysicsShape physic
101101
}
102102

103103
#endregion
104+
105+
#region Physics Objects in Auto-Properties
106+
107+
public static PhysicsWorld Get(this PhysicsWorld obj) => obj;
108+
public static PhysicsBody Get(this PhysicsBody obj) => obj;
109+
public static PhysicsShape Get(this PhysicsShape obj) => obj;
110+
public static PhysicsJoint Get(this PhysicsJoint obj) => obj;
111+
public static PhysicsDistanceJoint Get(this PhysicsDistanceJoint obj) => obj;
112+
public static PhysicsFixedJoint Get(this PhysicsFixedJoint obj) => obj;
113+
public static PhysicsHingeJoint Get(this PhysicsHingeJoint obj) => obj;
114+
public static PhysicsIgnoreJoint Get(this PhysicsIgnoreJoint obj) => obj;
115+
public static PhysicsRelativeJoint Get(this PhysicsRelativeJoint obj) => obj;
116+
public static PhysicsSliderJoint Get(this PhysicsSliderJoint obj) => obj;
117+
public static PhysicsWheelJoint Get(this PhysicsWheelJoint obj) => obj;
118+
119+
#endregion
104120
}

LowLevel/Projects/Snippets/Assets/Examples/SuggestedAPI/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ This snippet contains implementations for suggestions to the API.
44
When or if the API is implemented, these suggestions will be removed and noted here.
55

66
## Suggestions
7-
- [Thread](https://discussions.unity.com/t/lowlevel-physics-question/1696693/2) - PhysicsQuery.ShapeDistance extended to include a span of shapes and other utility.
7+
- [Discussions](https://discussions.unity.com/t/lowlevel-physics-question/1696693/2) - PhysicsQuery.ShapeDistance extended to include a span of shapes and other utility.
88
- See `PhysicsAPIExtensions.Shape-Distance`
9+
- [Discussions](https://discussions.unity.com/t/low-level-2d-physics-setting-struct-properties-is-cumbersome) - Returning physics objects when using auto-properties results in the compiler error (`CS1612`) indicating that you cannot modify the return value of 'X' because it is not a variable. These extensions allow that.
10+
- See: `PhysicsAPIExtensions.Get()`

0 commit comments

Comments
 (0)