AppleSCNPhysicsWorld - UBogun/Xojo-iosLib GitHub Wiki

Inherits from AppleObject
Memory leak check: not yet done.
Status: complete.

An SCNPhysicsWorld object simulates collisions and other physical properties in a scene.

You do not create SCNPhysicsWorld objects directly; instead, read the physicsWorld property of an SCNScene object.

Use physics world objects to perform the following tasks:

  • Manage global properties of the simulation, such as its speed and constant gravity. (For more precise control of gravity and similar effects, see the SCNPhysicsField class.)
  • Register behaviors that modify interactions between the scene’s physics bodies, such as joints and vehicles. For more details, see SCNPhysicsBehavior Class Reference.
  • Specify a delegate object to receive messages when two physics bodies contact each other. By default, the AppleSCNView that the correspond scene is attached to will become the delegate.
  • Perform specific contact tests, and search for physics bodies in the scene using ray and sweep tests._

Constructors

no constructor. See above.

Properties

Bahaviors As AppleArray Of AppleSCNPhysicsBahavior: The list of behaviors affecting bodies in the physics world. (read-only)

ContactDelegate As AppleObject: A delegate that is called when two physics bodies come in contact with each other. Is set automatically to the AppleSCNView when the scene containg tihs Physicsworld is added to the view’s scene property.

Gravity As SCNVector3: The gravitational acceleration applied to physics bodies in the physics world.

Speed As Double: The rate at which the simulation executes. Default 1.0. 2.0 means the physics simulation time passes twice as fast as the scene’s time.

TimeStep As Double: The time interval between updates to the physics simulation. Default 1/60.

Methods

AddBehavior (Behavior as AppleSCNPhysicsBehavior): Adds a behavior to the physics world.

ContactTest (Body As AppleSCNPhysicsBody, options as AppleSCNPhysicsWorldContactTestOptionsDictionary = nil) As AppleArray of AppleSCNPhysicsContact: Checks for contacts between one physics body and any other bodies in the physics world.

ContactTest (BodyA As AppleSCNPhysicsBody, BodyB As AppleSCNPhysicsBody, options as AppleSCNPhysicsWorldContactTestOptionsDictionary = nil) As AppleArray of AppleSCNPhysicsContact: Checks for contacts between two physics bodies.

ConvexTest (Shape As AppleSCNPhysicsShape, FromTRansform as SCNMatrix4, toTransform as SCNMatrix4, options as AppleSCNPhysicsWorldContactTestOptionsDictionary = nil) As AppleArray of AppleSCNPhysicsContact: Searches for physics bodies in the space formed by moving a convex shape through the physics world.

RayTest (Shape As AppleSCNPhysicsShape, FromTRansform as SCNMatrix4, toTransform as SCNMatrix4, options as AppleSCNPhysicsWorldContactTestOptionsDictionary = nil) As AppleArray of AppleSCNPhysicsContact: Searches for physics bodies along a line segment between two points in the physics world.

RemoveAllBehaviors(): Removes all behaviors affecting bodies in the physics world.

RemoveBehavior (Behavior as AppleSCNPhysicsBehavior): Removes a behavior from the physics world.

UpdateCollisionPairs(): Forces the physics engine to reevaluate possible collisions between physics bodies.