Skip to content

Commit b9f61f3

Browse files
committed
Update PointerControlledPhysicsHoldingComponent.swift
Add init(stopAngularVelocity:)
1 parent fc4a2fe commit b9f61f3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Sources/OctopusKit/Components/Input/Pointer/PointerControlledPhysicsHoldingComponent.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import SpriteKit
1010
import GameplayKit
1111

12-
/// Prevents the physics body of the entity's `SpriteKitComponent` node from moving while the node is touched or clicked by the player.
12+
/// Prevents the physics body of the entity's `PhysicsComponent` from moving while the node is touched or clicked by the player.
1313
///
1414
/// - Prevents the body from being affected by gravity while it is being held.
1515
/// - Sets the body's velocity to `0` every frame while it is being held.
@@ -32,6 +32,13 @@ public final class PointerControlledPhysicsHoldingComponent: OctopusComponent, O
3232
@LogInputEventChanges(propertyName: "PointerControlledPhysicsHoldingComponent.isHolding")
3333
public var isHolding: Bool = false
3434

35+
public init(stopAngularVelocity: Bool = false) {
36+
super.init()
37+
self.stopAngularVelocity = stopAngularVelocity
38+
}
39+
40+
public required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") }
41+
3542
public override func didAddToEntity(withNode node: SKNode) {
3643
super.didAddToEntity(withNode: node)
3744

0 commit comments

Comments
 (0)