MonoTouch.SpriteKit.SKPhysicsContactDelegate Class
A delegate object for MonoTouch.SpriteKit.SKPhysicsWorld that provides events when MonoTouch.SpriteKit.SKPhysicsBodys begin and end contact with each other.

See Also: SKPhysicsContactDelegate Members

Syntax

[MonoTouch.Foundation.Model]
[MonoTouch.Foundation.Protocol]
[MonoTouch.Foundation.Register("SKPhysicsContactDelegate", false)]
[MonoTouch.ObjCRuntime.Availability(Introduced=MonoTouch.ObjCRuntime.Platform.iOS_7_0)]
[MonoTouch.ObjCRuntime.Availability(Introduced=MonoTouch.ObjCRuntime.Platform.Mac_10_0 | MonoTouch.ObjCRuntime.Platform.Mac_10_1 | MonoTouch.ObjCRuntime.Platform.Mac_10_2 | MonoTouch.ObjCRuntime.Platform.Mac_10_3 | MonoTouch.ObjCRuntime.Platform.Mac_10_4 | MonoTouch.ObjCRuntime.Platform.Mac_10_5 | MonoTouch.ObjCRuntime.Platform.Mac_10_6 | MonoTouch.ObjCRuntime.Platform.Mac_10_7 | MonoTouch.ObjCRuntime.Platform.Mac_10_8 | MonoTouch.ObjCRuntime.Platform.Mac_10_9 | MonoTouch.ObjCRuntime.Platform.Mac_10_10 | MonoTouch.ObjCRuntime.Platform.Mac_Version | MonoTouch.ObjCRuntime.Platform.Mac_Arch64 | MonoTouch.ObjCRuntime.Platform.Mac_Arch)]
public class SKPhysicsContactDelegate : MonoTouch.Foundation.NSObject, ISKPhysicsContactDelegate, IDisposable

Remarks

The following example reverses gravity when a MonoTouch.SpriteKit.SKPhysicsBody named "Ball" encounters one of the bodies named either "TopWall" or "BottomWall":

C# Example

public override void DidBeginContact(SKPhysicsContact contact)
{
	if(contact.BodyA.Node.Name == "Ball" || contact.BodyB.Node.Name == "Ball")
	{
		if(contact.BodyA.Node.Name == "BottomWall" || contact.BodyB.Node.Name == "BottomWall" || contact.BodyA.Node.Name == "TopWall" || contact.BodyB.Node.Name == "TopWall")
		{
			world.Gravity = new PointF(0, -world.Gravity.Y);
		}
	}
}        
          

Related content

Requirements

Namespace: MonoTouch.SpriteKit
Assembly: monotouch (in monotouch.dll)
Assembly Versions: 0.0.0.0