Created
June 18, 2019 21:34
-
-
Save PedroFarina/d765bdee6606ab30d7cb8137005669d2 to your computer and use it in GitHub Desktop.
Physics Body Constructors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SpriteKit | |
var nodeGenerico = SKNode() | |
//Corpo físico a partir de uma imagem | |
nodeGenerico.physicsBody = SKPhysicsBody(texture: SKTexture(imageNamed: "name.jpg"), size: CGSize) | |
//Corpo físico a partir de dois pontos | |
nodeGenerico.physicsBody = SKPhysicsBody(edgeFrom: CGPoint, to: CGPoint) | |
//Corpo físico a partir de um raio | |
nodeGenerico.physicsBody = SKPhysicsBody(circleOfRadius: CGFloat) | |
//Corpo físico a partir de um caminho(UIBezierPath, CGMutablePath, etc) | |
nodeGenerico.physicsBody = SKPhysicsBody(edgeChainFrom: Path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment