SKPhysicsContactDelegate Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A delegate object for SKPhysicsWorld that provides events when SKPhysicsBodys begin and end contact with each other.
[Foundation.Model]
[Foundation.Protocol]
[Foundation.Register("Microsoft_iOS__SpriteKit_SKPhysicsContactDelegate", false)]
public class SKPhysicsContactDelegate : Foundation.NSObject, IDisposable, SpriteKit.ISKPhysicsContactDelegate
[Foundation.Model]
[Foundation.Protocol]
[Foundation.Register("Microsoft_MacCatalyst__SpriteKit_SKPhysicsContactDelegate", false)]
public class SKPhysicsContactDelegate : Foundation.NSObject, IDisposable, SpriteKit.ISKPhysicsContactDelegate
[Foundation.Model]
[Foundation.Protocol]
[Foundation.Register("Microsoft_macOS__SpriteKit_SKPhysicsContactDelegate", false)]
public class SKPhysicsContactDelegate : Foundation.NSObject, IDisposable, SpriteKit.ISKPhysicsContactDelegate
[Foundation.Model]
[Foundation.Protocol]
[Foundation.Register("Microsoft_tvOS__SpriteKit_SKPhysicsContactDelegate", false)]
public class SKPhysicsContactDelegate : Foundation.NSObject, IDisposable, SpriteKit.ISKPhysicsContactDelegate
[<Foundation.Model>]
[<Foundation.Protocol>]
[<Foundation.Register("Microsoft_iOS__SpriteKit_SKPhysicsContactDelegate", false)>]
type SKPhysicsContactDelegate = class
inherit NSObject
interface ISKPhysicsContactDelegate
interface INativeObject
interface IDisposable
[<Foundation.Model>]
[<Foundation.Protocol>]
[<Foundation.Register("Microsoft_MacCatalyst__SpriteKit_SKPhysicsContactDelegate", false)>]
type SKPhysicsContactDelegate = class
inherit NSObject
interface ISKPhysicsContactDelegate
interface INativeObject
interface IDisposable
[<Foundation.Model>]
[<Foundation.Protocol>]
[<Foundation.Register("Microsoft_macOS__SpriteKit_SKPhysicsContactDelegate", false)>]
type SKPhysicsContactDelegate = class
inherit NSObject
interface ISKPhysicsContactDelegate
interface INativeObject
interface IDisposable
[<Foundation.Model>]
[<Foundation.Protocol>]
[<Foundation.Register("Microsoft_tvOS__SpriteKit_SKPhysicsContactDelegate", false)>]
type SKPhysicsContactDelegate = class
inherit NSObject
interface ISKPhysicsContactDelegate
interface INativeObject
interface IDisposable
- Inheritance
- Attributes
- Implements
Remarks
The following example reverses gravity when a SKPhysicsBody named "Sphere" encounters one of the bodies named either "TopWall" or "BottomWall":
public override void DidBeginContact(SKPhysicsContact contact)
{
if(contact.BodyA.Node.Name == "Sphere" || contact.BodyB.Node.Name == "Sphere")
{
if(contact.BodyA.Node.Name == "BottomWall" || contact.BodyB.Node.Name == "BottomWall" || contact.BodyA.Node.Name == "TopWall" || contact.BodyB.Node.Name == "TopWall")
{
world.Gravity = new CGPoint(0, -world.Gravity.Y);
}
}
}
Constructors
| Name | Description |
|---|---|
| SKPhysicsContactDelegate() |
Creates a new SKPhysicsContactDelegate with default values. |
| SKPhysicsContactDelegate(NativeHandle) |
A constructor used when creating managed representations of unmanaged objects. Called by the runtime. |
| SKPhysicsContactDelegate(NSObjectFlag) |
Constructor to call on derived classes to skip initialization and merely allocate the object. |
Properties
| Name | Description |
|---|---|
| AccessibilityAttributedUserInputLabels | (Inherited from NSObject) |
| AccessibilityRespondsToUserInteraction | (Inherited from NSObject) |
| AccessibilityTextualContext | (Inherited from NSObject) |
| AccessibilityUserInputLabels | (Inherited from NSObject) |
| Class | (Inherited from NSObject) |
| ClassHandle |
The Objective-C class handle for this class. (Inherited from NSObject) |
| DebugDescription | (Inherited from NSObject) |
| Description | (Inherited from NSObject) |
| ExposedBindings | (Inherited from NSObject) |
| Handle |
Handle (pointer) to the unmanaged object representation. (Inherited from NSObject) |
| IsDirectBinding | (Inherited from NSObject) |
| IsProxy | (Inherited from NSObject) |
| RetainCount | (Inherited from NSObject) |
| Self | (Inherited from NSObject) |
| Superclass | (Inherited from NSObject) |
| SuperHandle |
Handle used to represent the methods in the base class for this NSObject. (Inherited from NSObject) |
| Zone | (Inherited from NSObject) |