From 49a333b6371cf63561734b06f183ee82fa1268cb Mon Sep 17 00:00:00 2001 From: Markus Yeo Date: Sun, 21 Apr 2024 17:37:16 +0800 Subject: [PATCH] [ark-physics-kit] fix: remove redundant guard let --- ArkKit/ark-physics-kit/ArkPhysicsSyncSystem.swift | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/ArkKit/ark-physics-kit/ArkPhysicsSyncSystem.swift b/ArkKit/ark-physics-kit/ArkPhysicsSyncSystem.swift index 7851f64..dd6936f 100644 --- a/ArkKit/ark-physics-kit/ArkPhysicsSyncSystem.swift +++ b/ArkKit/ark-physics-kit/ArkPhysicsSyncSystem.swift @@ -165,21 +165,14 @@ struct PhysicsComponentSync: ComponentSyncing { struct PositionComponentSync: ComponentSyncing { func sync(entity: Entity, with physicsBody: AbstractArkPhysicsBody, using arkECS: ArkECS) { - guard let positionComponent: PositionComponent = - arkECS.getComponent(ofType: PositionComponent.self, for: entity) else { - return } - var newPositionComp = positionComponent - newPositionComp.position = physicsBody.position + let newPositionComp = PositionComponent(position: physicsBody.position) arkECS.upsertComponent(newPositionComp, to: entity) } } struct RotationComponentSync: ComponentSyncing { func sync(entity: Entity, with physicsBody: AbstractArkPhysicsBody, using arkECS: ArkECS) { - guard var rotationComponent: RotationComponent = - arkECS.getComponent(ofType: RotationComponent.self, for: entity) else { - return } - rotationComponent.angleInRadians = physicsBody.zRotation + let rotationComponent = RotationComponent(angleInRadians: physicsBody.zRotation) arkECS.upsertComponent(rotationComponent, to: entity) } }