-
Notifications
You must be signed in to change notification settings - Fork 1
/
SDPhysicsBody.swift
54 lines (43 loc) · 1.28 KB
/
SDPhysicsBody.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import SpriteKit
public class SDPhysicsBody {
let body: SKPhysicsBody
public init(rectangleOf size: CGSize) {
body = SKPhysicsBody(rectangleOf: size)
}
public init(circleOf radius: CGFloat) {
body = SKPhysicsBody(circleOfRadius: radius)
}
public var mass: CGFloat {
get { body.mass }
set { body.mass = newValue }
}
public var velocity: CGVector {
get { body.velocity }
set { body.velocity = newValue }
}
public var force: CGVector {
// get { body.force }
// set { body.force = newValue }
CGVector(dx: 0, dy: 0)
}
public var affectedByGravity: Bool {
get { body.affectedByGravity }
set { body.affectedByGravity = newValue }
}
public var isDynamic: Bool {
get { body.isDynamic }
set { body.isDynamic = newValue }
}
public var categoryBitMask: UInt32 {
get { body.categoryBitMask }
set { body.categoryBitMask = newValue }
}
public var contactTestMask: UInt32 {
get { body.contactTestBitMask }
set { body.contactTestBitMask = newValue }
}
public var collisionBitMask: UInt32 {
get { body.collisionBitMask }
set { body.collisionBitMask = newValue }
}
}