Description
The Deconstruct
method is a member of the PhysicsIntersection
struct in the Sandbox namespace. This method is used to deconstruct a PhysicsIntersection
instance into its constituent parts: Self
, Other
, and Contact
. This is particularly useful for pattern matching and tuple deconstruction in C#.
Usage
To use the Deconstruct
method, you need to have an instance of PhysicsIntersection
. You can then call this method to extract the Self
, Other
, and Contact
properties into separate variables.
Note that the parameters are marked with out
, meaning they will be assigned values within the method.
Example
// Example of using the Deconstruct method
PhysicsIntersection intersection = GetPhysicsIntersection();
intersection.Deconstruct(out PhysicsContact.Target self, out PhysicsContact.Target other, out PhysicsContact contact);
// Now you can use the self, other, and contact variables
Console.WriteLine($"Self: {self}, Other: {other}, Contact: {contact}");