├── .gitignore ├── BodyDetection.xcodeproj ├── .xcodesamplecode.plist ├── project.pbxproj └── project.xcworkspace │ └── xcshareddata │ └── WorkspaceSettings.xcsettings ├── BodyDetection ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── AR_icon_3D copy-1.png │ │ ├── AR_icon_3D copy-10.png │ │ ├── AR_icon_3D copy-11.png │ │ ├── AR_icon_3D copy-12.png │ │ ├── AR_icon_3D copy-13.png │ │ ├── AR_icon_3D copy-2.png │ │ ├── AR_icon_3D copy-3.png │ │ ├── AR_icon_3D copy-4.png │ │ ├── AR_icon_3D copy-5.png │ │ ├── AR_icon_3D copy-6.png │ │ ├── AR_icon_3D copy-7.png │ │ ├── AR_icon_3D copy-8.png │ │ ├── AR_icon_3D copy-9.png │ │ ├── AR_icon_3D copy.png │ │ ├── AR_icon_3D.png │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── MessageLabel.swift ├── Utilities.swift ├── ViewController.swift └── character │ └── robot.usdz ├── Configuration └── SampleCode.xcconfig ├── LICENSE └── LICENSE.txt └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # See LICENSE folder for this sample’s licensing information. 2 | # 3 | # Apple sample code gitignore configuration. 4 | 5 | # Finder 6 | .DS_Store 7 | 8 | # Xcode - User files 9 | xcuserdata/ 10 | 11 | **/*.xcodeproj/project.xcworkspace/* 12 | !**/*.xcodeproj/project.xcworkspace/xcshareddata 13 | 14 | **/*.xcodeproj/project.xcworkspace/xcshareddata/* 15 | !**/*.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings 16 | 17 | **/*.playground/playground.xcworkspace/* 18 | !**/*.playground/playground.xcworkspace/xcshareddata 19 | 20 | **/*.playground/playground.xcworkspace/xcshareddata/* 21 | !**/*.playground/playground.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings 22 | -------------------------------------------------------------------------------- /BodyDetection.xcodeproj/.xcodesamplecode.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /BodyDetection.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0C0AADE42290B23100E0502A /* MessageLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C0AADE32290B23100E0502A /* MessageLabel.swift */; }; 11 | 0C71C056228FA198003621C4 /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C71C055228FA198003621C4 /* Utilities.swift */; }; 12 | 0C8C7868228387D2006A6EE1 /* character in Resources */ = {isa = PBXBuildFile; fileRef = 0C8C7867228387D2006A6EE1 /* character */; }; 13 | 2F60E1DB22631E0F00357E98 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F60E1DA22631E0F00357E98 /* AppDelegate.swift */; }; 14 | 2F60E1DD22631E0F00357E98 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F60E1DC22631E0F00357E98 /* ViewController.swift */; }; 15 | 2F60E1E222631E0F00357E98 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2F60E1E022631E0F00357E98 /* Main.storyboard */; }; 16 | 2F60E1E422631E0F00357E98 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2F60E1E322631E0F00357E98 /* Assets.xcassets */; }; 17 | 2F60E1E722631E0F00357E98 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2F60E1E522631E0F00357E98 /* LaunchScreen.storyboard */; }; 18 | 718E55BC2289F8FF00A9B13B /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 718E55BB2289F8FF00A9B13B /* README.md */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXFileReference section */ 22 | 0C0AADE32290B23100E0502A /* MessageLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageLabel.swift; sourceTree = ""; }; 23 | 0C71C055228FA198003621C4 /* Utilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utilities.swift; sourceTree = ""; }; 24 | 0C8C7867228387D2006A6EE1 /* character */ = {isa = PBXFileReference; lastKnownFileType = folder; path = character; sourceTree = ""; }; 25 | 2F60E1D822631E0E00357E98 /* Joint Visualizer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Joint Visualizer.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 26 | 2F60E1DA22631E0F00357E98 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 27 | 2F60E1DC22631E0F00357E98 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 28 | 2F60E1E122631E0F00357E98 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 29 | 2F60E1E322631E0F00357E98 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 30 | 2F60E1E622631E0F00357E98 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 31 | 2F60E1EB22631E0F00357E98 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | 718E55BB2289F8FF00A9B13B /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; }; 33 | D34ABD00D34AB41000000001 /* LICENSE.txt */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = LICENSE.txt; sourceTree = ""; }; 34 | D3749170D374E6D000000001 /* SampleCode.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = SampleCode.xcconfig; path = Configuration/SampleCode.xcconfig; sourceTree = ""; }; 35 | /* End PBXFileReference section */ 36 | 37 | /* Begin PBXFrameworksBuildPhase section */ 38 | 2F60E1D522631E0E00357E98 /* Frameworks */ = { 39 | isa = PBXFrameworksBuildPhase; 40 | buildActionMask = 2147483647; 41 | files = ( 42 | ); 43 | runOnlyForDeploymentPostprocessing = 0; 44 | }; 45 | /* End PBXFrameworksBuildPhase section */ 46 | 47 | /* Begin PBXGroup section */ 48 | 2F60E1B122631DCF00357E98 = { 49 | isa = PBXGroup; 50 | children = ( 51 | 718E55BB2289F8FF00A9B13B /* README.md */, 52 | 2F60E1D922631E0F00357E98 /* BodyDetection */, 53 | 2F60E1BB22631DCF00357E98 /* Products */, 54 | D37497E0D37497A000000001 /* Configuration */, 55 | D34AB110D34AB26000000001 /* LICENSE */, 56 | ); 57 | sourceTree = ""; 58 | }; 59 | 2F60E1BB22631DCF00357E98 /* Products */ = { 60 | isa = PBXGroup; 61 | children = ( 62 | 2F60E1D822631E0E00357E98 /* Joint Visualizer.app */, 63 | ); 64 | name = Products; 65 | sourceTree = ""; 66 | }; 67 | 2F60E1D922631E0F00357E98 /* BodyDetection */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | 2F60E1DA22631E0F00357E98 /* AppDelegate.swift */, 71 | 2F60E1DC22631E0F00357E98 /* ViewController.swift */, 72 | 0C0AADE32290B23100E0502A /* MessageLabel.swift */, 73 | 0C71C055228FA198003621C4 /* Utilities.swift */, 74 | 0C8C7867228387D2006A6EE1 /* character */, 75 | 2F60E1E022631E0F00357E98 /* Main.storyboard */, 76 | 2F60E1E322631E0F00357E98 /* Assets.xcassets */, 77 | 2F60E1E522631E0F00357E98 /* LaunchScreen.storyboard */, 78 | 2F60E1EB22631E0F00357E98 /* Info.plist */, 79 | ); 80 | path = BodyDetection; 81 | sourceTree = ""; 82 | }; 83 | D34AB110D34AB26000000001 /* LICENSE */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | D34ABD00D34AB41000000001 /* LICENSE.txt */, 87 | ); 88 | path = LICENSE; 89 | sourceTree = ""; 90 | }; 91 | D37497E0D37497A000000001 /* Configuration */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | D3749170D374E6D000000001 /* SampleCode.xcconfig */, 95 | ); 96 | name = Configuration; 97 | sourceTree = ""; 98 | }; 99 | /* End PBXGroup section */ 100 | 101 | /* Begin PBXNativeTarget section */ 102 | 2F60E1D722631E0E00357E98 /* BodyDetection */ = { 103 | isa = PBXNativeTarget; 104 | buildConfigurationList = 2F60E1EE22631E0F00357E98 /* Build configuration list for PBXNativeTarget "BodyDetection" */; 105 | buildPhases = ( 106 | 2F60E1D422631E0E00357E98 /* Sources */, 107 | 2F60E1D522631E0E00357E98 /* Frameworks */, 108 | 2F60E1D622631E0E00357E98 /* Resources */, 109 | ); 110 | buildRules = ( 111 | ); 112 | dependencies = ( 113 | ); 114 | name = BodyDetection; 115 | productName = Simple; 116 | productReference = 2F60E1D822631E0E00357E98 /* Joint Visualizer.app */; 117 | productType = "com.apple.product-type.application"; 118 | }; 119 | /* End PBXNativeTarget section */ 120 | 121 | /* Begin PBXProject section */ 122 | 2F60E1B222631DCF00357E98 /* Project object */ = { 123 | isa = PBXProject; 124 | attributes = { 125 | DefaultBuildSystemTypeForWorkspace = Latest; 126 | LastSwiftUpdateCheck = 1100; 127 | LastUpgradeCheck = 1100; 128 | ORGANIZATIONNAME = Apple; 129 | TargetAttributes = { 130 | 2F60E1D722631E0E00357E98 = { 131 | CreatedOnToolsVersion = 11.0; 132 | }; 133 | }; 134 | }; 135 | buildConfigurationList = 2F60E1B522631DCF00357E98 /* Build configuration list for PBXProject "BodyDetection" */; 136 | compatibilityVersion = "Xcode 9.3"; 137 | developmentRegion = en; 138 | hasScannedForEncodings = 0; 139 | knownRegions = ( 140 | en, 141 | Base, 142 | ); 143 | mainGroup = 2F60E1B122631DCF00357E98; 144 | productRefGroup = 2F60E1BB22631DCF00357E98 /* Products */; 145 | projectDirPath = ""; 146 | projectRoot = ""; 147 | targets = ( 148 | 2F60E1D722631E0E00357E98 /* BodyDetection */, 149 | ); 150 | }; 151 | /* End PBXProject section */ 152 | 153 | /* Begin PBXResourcesBuildPhase section */ 154 | 2F60E1D622631E0E00357E98 /* Resources */ = { 155 | isa = PBXResourcesBuildPhase; 156 | buildActionMask = 2147483647; 157 | files = ( 158 | 0C8C7868228387D2006A6EE1 /* character in Resources */, 159 | 2F60E1E722631E0F00357E98 /* LaunchScreen.storyboard in Resources */, 160 | 718E55BC2289F8FF00A9B13B /* README.md in Resources */, 161 | 2F60E1E422631E0F00357E98 /* Assets.xcassets in Resources */, 162 | 2F60E1E222631E0F00357E98 /* Main.storyboard in Resources */, 163 | ); 164 | runOnlyForDeploymentPostprocessing = 0; 165 | }; 166 | /* End PBXResourcesBuildPhase section */ 167 | 168 | /* Begin PBXSourcesBuildPhase section */ 169 | 2F60E1D422631E0E00357E98 /* Sources */ = { 170 | isa = PBXSourcesBuildPhase; 171 | buildActionMask = 2147483647; 172 | files = ( 173 | 0C71C056228FA198003621C4 /* Utilities.swift in Sources */, 174 | 2F60E1DD22631E0F00357E98 /* ViewController.swift in Sources */, 175 | 0C0AADE42290B23100E0502A /* MessageLabel.swift in Sources */, 176 | 2F60E1DB22631E0F00357E98 /* AppDelegate.swift in Sources */, 177 | ); 178 | runOnlyForDeploymentPostprocessing = 0; 179 | }; 180 | /* End PBXSourcesBuildPhase section */ 181 | 182 | /* Begin PBXVariantGroup section */ 183 | 2F60E1E022631E0F00357E98 /* Main.storyboard */ = { 184 | isa = PBXVariantGroup; 185 | children = ( 186 | 2F60E1E122631E0F00357E98 /* Base */, 187 | ); 188 | name = Main.storyboard; 189 | sourceTree = ""; 190 | }; 191 | 2F60E1E522631E0F00357E98 /* LaunchScreen.storyboard */ = { 192 | isa = PBXVariantGroup; 193 | children = ( 194 | 2F60E1E622631E0F00357E98 /* Base */, 195 | ); 196 | name = LaunchScreen.storyboard; 197 | sourceTree = ""; 198 | }; 199 | /* End PBXVariantGroup section */ 200 | 201 | /* Begin XCBuildConfiguration section */ 202 | 2F60E1CF22631DD100357E98 /* Debug */ = { 203 | isa = XCBuildConfiguration; 204 | baseConfigurationReference = D3749170D374E6D000000001 /* SampleCode.xcconfig */; 205 | buildSettings = { 206 | ALWAYS_SEARCH_USER_PATHS = NO; 207 | CLANG_ANALYZER_NONNULL = YES; 208 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 209 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 210 | CLANG_CXX_LIBRARY = "libc++"; 211 | CLANG_ENABLE_MODULES = YES; 212 | CLANG_ENABLE_OBJC_ARC = YES; 213 | CLANG_ENABLE_OBJC_WEAK = YES; 214 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 215 | CLANG_WARN_BOOL_CONVERSION = YES; 216 | CLANG_WARN_COMMA = YES; 217 | CLANG_WARN_CONSTANT_CONVERSION = YES; 218 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 219 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 220 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 221 | CLANG_WARN_EMPTY_BODY = YES; 222 | CLANG_WARN_ENUM_CONVERSION = YES; 223 | CLANG_WARN_INFINITE_RECURSION = YES; 224 | CLANG_WARN_INT_CONVERSION = YES; 225 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 226 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 227 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 228 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 229 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 230 | CLANG_WARN_STRICT_PROTOTYPES = YES; 231 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 232 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 233 | CLANG_WARN_UNREACHABLE_CODE = YES; 234 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 235 | CODE_SIGN_IDENTITY = "-"; 236 | COPY_PHASE_STRIP = NO; 237 | DEBUG_INFORMATION_FORMAT = dwarf; 238 | ENABLE_STRICT_OBJC_MSGSEND = YES; 239 | ENABLE_TESTABILITY = YES; 240 | GCC_C_LANGUAGE_STANDARD = gnu11; 241 | GCC_DYNAMIC_NO_PIC = NO; 242 | GCC_NO_COMMON_BLOCKS = YES; 243 | GCC_OPTIMIZATION_LEVEL = 0; 244 | GCC_PREPROCESSOR_DEFINITIONS = ( 245 | "DEBUG=1", 246 | "$(inherited)", 247 | ); 248 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 249 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 250 | GCC_WARN_UNDECLARED_SELECTOR = YES; 251 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 252 | GCC_WARN_UNUSED_FUNCTION = YES; 253 | GCC_WARN_UNUSED_VARIABLE = YES; 254 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 255 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 256 | MTL_FAST_MATH = YES; 257 | ONLY_ACTIVE_ARCH = YES; 258 | SDKROOT = iphoneos; 259 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 260 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 261 | SWIFT_VERSION = 5.0; 262 | }; 263 | name = Debug; 264 | }; 265 | 2F60E1D022631DD100357E98 /* Release */ = { 266 | isa = XCBuildConfiguration; 267 | baseConfigurationReference = D3749170D374E6D000000001 /* SampleCode.xcconfig */; 268 | buildSettings = { 269 | ALWAYS_SEARCH_USER_PATHS = NO; 270 | CLANG_ANALYZER_NONNULL = YES; 271 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 272 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 273 | CLANG_CXX_LIBRARY = "libc++"; 274 | CLANG_ENABLE_MODULES = YES; 275 | CLANG_ENABLE_OBJC_ARC = YES; 276 | CLANG_ENABLE_OBJC_WEAK = YES; 277 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 278 | CLANG_WARN_BOOL_CONVERSION = YES; 279 | CLANG_WARN_COMMA = YES; 280 | CLANG_WARN_CONSTANT_CONVERSION = YES; 281 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 282 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 283 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 284 | CLANG_WARN_EMPTY_BODY = YES; 285 | CLANG_WARN_ENUM_CONVERSION = YES; 286 | CLANG_WARN_INFINITE_RECURSION = YES; 287 | CLANG_WARN_INT_CONVERSION = YES; 288 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 289 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 290 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 291 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 292 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 293 | CLANG_WARN_STRICT_PROTOTYPES = YES; 294 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 295 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 296 | CLANG_WARN_UNREACHABLE_CODE = YES; 297 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 298 | CODE_SIGN_IDENTITY = "-"; 299 | COPY_PHASE_STRIP = NO; 300 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 301 | ENABLE_NS_ASSERTIONS = NO; 302 | ENABLE_STRICT_OBJC_MSGSEND = YES; 303 | GCC_C_LANGUAGE_STANDARD = gnu11; 304 | GCC_NO_COMMON_BLOCKS = YES; 305 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 306 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 307 | GCC_WARN_UNDECLARED_SELECTOR = YES; 308 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 309 | GCC_WARN_UNUSED_FUNCTION = YES; 310 | GCC_WARN_UNUSED_VARIABLE = YES; 311 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 312 | MTL_ENABLE_DEBUG_INFO = NO; 313 | MTL_FAST_MATH = YES; 314 | SDKROOT = iphoneos; 315 | SWIFT_COMPILATION_MODE = wholemodule; 316 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 317 | SWIFT_VERSION = 5.0; 318 | VALIDATE_PRODUCT = YES; 319 | }; 320 | name = Release; 321 | }; 322 | 2F60E1EC22631E0F00357E98 /* Debug */ = { 323 | isa = XCBuildConfiguration; 324 | baseConfigurationReference = D3749170D374E6D000000001 /* SampleCode.xcconfig */; 325 | buildSettings = { 326 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 327 | CODE_SIGN_IDENTITY = "iPhone Developer"; 328 | CODE_SIGN_STYLE = Automatic; 329 | DEVELOPMENT_TEAM = UDGF2JUP82; 330 | ENABLE_RCPROJECT_COMPILATION = YES; 331 | ENABLE_USDZ_COMPILATION = YES; 332 | INFOPLIST_FILE = "$(SRCROOT)/BodyDetection/Info.plist"; 333 | LD_RUNPATH_SEARCH_PATHS = ( 334 | "$(inherited)", 335 | "@executable_path/Frameworks", 336 | ); 337 | MARKETING_VERSION = 1.0; 338 | PRODUCT_BUNDLE_IDENTIFIER = "com.example.apple-samplecode.BodyDetection${SAMPLE_CODE_DISAMBIGUATOR}"; 339 | PRODUCT_NAME = "Joint Visualizer"; 340 | PROVISIONING_PROFILE_SPECIFIER = ""; 341 | SDKROOT = iphoneos; 342 | SWIFT_VERSION = 5.0; 343 | TARGETED_DEVICE_FAMILY = "1,2"; 344 | }; 345 | name = Debug; 346 | }; 347 | 2F60E1ED22631E0F00357E98 /* Release */ = { 348 | isa = XCBuildConfiguration; 349 | baseConfigurationReference = D3749170D374E6D000000001 /* SampleCode.xcconfig */; 350 | buildSettings = { 351 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 352 | CODE_SIGN_IDENTITY = "iPhone Developer"; 353 | CODE_SIGN_STYLE = Automatic; 354 | DEVELOPMENT_TEAM = UDGF2JUP82; 355 | ENABLE_RCPROJECT_COMPILATION = YES; 356 | ENABLE_USDZ_COMPILATION = YES; 357 | INFOPLIST_FILE = "$(SRCROOT)/BodyDetection/Info.plist"; 358 | LD_RUNPATH_SEARCH_PATHS = ( 359 | "$(inherited)", 360 | "@executable_path/Frameworks", 361 | ); 362 | MARKETING_VERSION = 1.0; 363 | PRODUCT_BUNDLE_IDENTIFIER = "com.example.apple-samplecode.BodyDetection${SAMPLE_CODE_DISAMBIGUATOR}"; 364 | PRODUCT_NAME = "Joint Visualizer"; 365 | PROVISIONING_PROFILE_SPECIFIER = ""; 366 | SDKROOT = iphoneos; 367 | SWIFT_VERSION = 5.0; 368 | TARGETED_DEVICE_FAMILY = "1,2"; 369 | }; 370 | name = Release; 371 | }; 372 | /* End XCBuildConfiguration section */ 373 | 374 | /* Begin XCConfigurationList section */ 375 | 2F60E1B522631DCF00357E98 /* Build configuration list for PBXProject "BodyDetection" */ = { 376 | isa = XCConfigurationList; 377 | buildConfigurations = ( 378 | 2F60E1CF22631DD100357E98 /* Debug */, 379 | 2F60E1D022631DD100357E98 /* Release */, 380 | ); 381 | defaultConfigurationIsVisible = 0; 382 | defaultConfigurationName = Release; 383 | }; 384 | 2F60E1EE22631E0F00357E98 /* Build configuration list for PBXNativeTarget "BodyDetection" */ = { 385 | isa = XCConfigurationList; 386 | buildConfigurations = ( 387 | 2F60E1EC22631E0F00357E98 /* Debug */, 388 | 2F60E1ED22631E0F00357E98 /* Release */, 389 | ); 390 | defaultConfigurationIsVisible = 0; 391 | defaultConfigurationName = Release; 392 | }; 393 | /* End XCConfigurationList section */ 394 | }; 395 | rootObject = 2F60E1B222631DCF00357E98 /* Project object */; 396 | } 397 | -------------------------------------------------------------------------------- /BodyDetection.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildSystemType 6 | Latest 7 | 8 | 9 | -------------------------------------------------------------------------------- /BodyDetection/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | /* 2 | See LICENSE folder for this sample’s licensing information. 3 | 4 | Abstract: 5 | Application's delegate. 6 | */ 7 | 8 | import UIKit 9 | 10 | @UIApplicationMain 11 | class AppDelegate: UIResponder, UIApplicationDelegate { 12 | 13 | var window: UIWindow? 14 | 15 | func application(_ application: UIApplication, 16 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) 17 | -> Bool { 18 | return true 19 | } 20 | 21 | func applicationWillResignActive(_ application: UIApplication) { 22 | } 23 | 24 | func applicationDidEnterBackground(_ application: UIApplication) { 25 | } 26 | 27 | func applicationWillEnterForeground(_ application: UIApplication) { 28 | } 29 | 30 | func applicationDidBecomeActive(_ application: UIApplication) { 31 | } 32 | 33 | func applicationWillTerminate(_ application: UIApplication) { 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valengo/jointVisualizer/af2523737234c42e3131e772bda93c6bd1359e5a/BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-1.png -------------------------------------------------------------------------------- /BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valengo/jointVisualizer/af2523737234c42e3131e772bda93c6bd1359e5a/BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-10.png -------------------------------------------------------------------------------- /BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valengo/jointVisualizer/af2523737234c42e3131e772bda93c6bd1359e5a/BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-11.png -------------------------------------------------------------------------------- /BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valengo/jointVisualizer/af2523737234c42e3131e772bda93c6bd1359e5a/BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-12.png -------------------------------------------------------------------------------- /BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valengo/jointVisualizer/af2523737234c42e3131e772bda93c6bd1359e5a/BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-13.png -------------------------------------------------------------------------------- /BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valengo/jointVisualizer/af2523737234c42e3131e772bda93c6bd1359e5a/BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-2.png -------------------------------------------------------------------------------- /BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valengo/jointVisualizer/af2523737234c42e3131e772bda93c6bd1359e5a/BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-3.png -------------------------------------------------------------------------------- /BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valengo/jointVisualizer/af2523737234c42e3131e772bda93c6bd1359e5a/BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-4.png -------------------------------------------------------------------------------- /BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valengo/jointVisualizer/af2523737234c42e3131e772bda93c6bd1359e5a/BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-5.png -------------------------------------------------------------------------------- /BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valengo/jointVisualizer/af2523737234c42e3131e772bda93c6bd1359e5a/BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-6.png -------------------------------------------------------------------------------- /BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valengo/jointVisualizer/af2523737234c42e3131e772bda93c6bd1359e5a/BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-7.png -------------------------------------------------------------------------------- /BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valengo/jointVisualizer/af2523737234c42e3131e772bda93c6bd1359e5a/BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-8.png -------------------------------------------------------------------------------- /BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valengo/jointVisualizer/af2523737234c42e3131e772bda93c6bd1359e5a/BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy-9.png -------------------------------------------------------------------------------- /BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valengo/jointVisualizer/af2523737234c42e3131e772bda93c6bd1359e5a/BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D copy.png -------------------------------------------------------------------------------- /BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valengo/jointVisualizer/af2523737234c42e3131e772bda93c6bd1359e5a/BodyDetection/Assets.xcassets/AppIcon.appiconset/AR_icon_3D.png -------------------------------------------------------------------------------- /BodyDetection/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "AR_icon_3D copy-2.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "AR_icon_3D copy-3.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "AR_icon_3D copy-6.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "AR_icon_3D copy-8.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "AR_icon_3D copy.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "AR_icon_3D copy-5.png", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "AR_icon_3D copy-4.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "AR_icon_3D copy-9.png", 49 | "scale" : "3x" 50 | }, 51 | { 52 | "idiom" : "ipad", 53 | "size" : "20x20", 54 | "scale" : "1x" 55 | }, 56 | { 57 | "size" : "20x20", 58 | "idiom" : "ipad", 59 | "filename" : "AR_icon_3D copy-10.png", 60 | "scale" : "2x" 61 | }, 62 | { 63 | "idiom" : "ipad", 64 | "size" : "29x29", 65 | "scale" : "1x" 66 | }, 67 | { 68 | "size" : "29x29", 69 | "idiom" : "ipad", 70 | "filename" : "AR_icon_3D copy-7.png", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "40x40", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "size" : "40x40", 80 | "idiom" : "ipad", 81 | "filename" : "AR_icon_3D copy-1.png", 82 | "scale" : "2x" 83 | }, 84 | { 85 | "size" : "76x76", 86 | "idiom" : "ipad", 87 | "filename" : "AR_icon_3D copy-11.png", 88 | "scale" : "1x" 89 | }, 90 | { 91 | "size" : "76x76", 92 | "idiom" : "ipad", 93 | "filename" : "AR_icon_3D copy-12.png", 94 | "scale" : "2x" 95 | }, 96 | { 97 | "size" : "83.5x83.5", 98 | "idiom" : "ipad", 99 | "filename" : "AR_icon_3D copy-13.png", 100 | "scale" : "2x" 101 | }, 102 | { 103 | "size" : "1024x1024", 104 | "idiom" : "ios-marketing", 105 | "filename" : "AR_icon_3D.png", 106 | "scale" : "1x" 107 | } 108 | ], 109 | "info" : { 110 | "version" : 1, 111 | "author" : "xcode" 112 | } 113 | } -------------------------------------------------------------------------------- /BodyDetection/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /BodyDetection/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /BodyDetection/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 29 | 37 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 68 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /BodyDetection/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | NSCameraUsageDescription 24 | This application will use the camera for Augmented Reality. 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | arkit 33 | 34 | UIStatusBarHidden 35 | 36 | UISupportedInterfaceOrientations 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UISupportedInterfaceOrientations~ipad 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationPortraitUpsideDown 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /BodyDetection/MessageLabel.swift: -------------------------------------------------------------------------------- 1 | /* 2 | See LICENSE folder for this sample’s licensing information. 3 | 4 | Abstract: 5 | A label to present the user with feedback. 6 | */ 7 | 8 | import UIKit 9 | 10 | @IBDesignable 11 | class MessageLabel: UILabel { 12 | 13 | override func drawText(in rect: CGRect) { 14 | let insets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 5) 15 | super.drawText(in: rect.inset(by: insets)) 16 | } 17 | 18 | func displayMessage(_ text: String, duration: TimeInterval) { 19 | DispatchQueue.main.async { 20 | self.isHidden = false 21 | self.text = text 22 | } 23 | 24 | // Use tag to tell if the label has been updated. 25 | let tag = self.tag + 1 26 | self.tag = tag 27 | 28 | DispatchQueue.main.asyncAfter(deadline: .now() + duration) { 29 | // Do not hide if showMessage is called again before this block kicks in. 30 | if self.tag == tag { 31 | self.isHidden = true 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /BodyDetection/Utilities.swift: -------------------------------------------------------------------------------- 1 | /* 2 | See LICENSE folder for this sample’s licensing information. 3 | 4 | Abstract: 5 | Utility functions that support the sample app. 6 | */ 7 | 8 | import Foundation 9 | import RealityKit 10 | import ARKit 11 | 12 | extension MeshResource { 13 | /** 14 | Generate three axes of a coordinate system with x axis = red, y axis = green and z axis = blue 15 | - parameters: 16 | - axisLength: Length of the axes in m 17 | - thickness: Thickness of the axes as a percentage of their length 18 | */ 19 | static func generateCoordinateSystemAxes(length: Float = 0.1, thickness: Float = 2.0) -> Entity { 20 | let thicknessInM = (length / 100) * thickness 21 | let cornerRadius = thickness / 2.0 22 | let offset = length / 2.0 23 | 24 | let xAxisBox = MeshResource.generateBox(size: [length, thicknessInM, thicknessInM], cornerRadius: cornerRadius) 25 | let yAxisBox = MeshResource.generateBox(size: [thicknessInM, length, thicknessInM], cornerRadius: cornerRadius) 26 | let zAxisBox = MeshResource.generateBox(size: [thicknessInM, thicknessInM, length], cornerRadius: cornerRadius) 27 | 28 | let xAxis = ModelEntity(mesh: xAxisBox, materials: [UnlitMaterial(color: .red)]) 29 | let yAxis = ModelEntity(mesh: yAxisBox, materials: [UnlitMaterial(color: .green)]) 30 | let zAxis = ModelEntity(mesh: zAxisBox, materials: [UnlitMaterial(color: .blue)]) 31 | 32 | xAxis.position = [offset, 0, 0] 33 | yAxis.position = [0, offset, 0] 34 | zAxis.position = [0, 0, offset] 35 | 36 | let axes = Entity() 37 | axes.addChild(xAxis) 38 | axes.addChild(yAxis) 39 | axes.addChild(zAxis) 40 | return axes 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /BodyDetection/ViewController.swift: -------------------------------------------------------------------------------- 1 | /* 2 | See LICENSE folder for this sample’s licensing information. 3 | 4 | Abstract: 5 | The sample app's main view controller. 6 | */ 7 | 8 | import UIKit 9 | import RealityKit 10 | import ARKit 11 | import Combine 12 | 13 | class CustomSphere: Entity, HasModel { 14 | required init(color: UIColor, radius: Float) { 15 | super.init() 16 | self.components[ModelComponent] = ModelComponent( 17 | mesh: .generateSphere(radius: radius), 18 | materials: [SimpleMaterial( 19 | color: color, 20 | isMetallic: false) 21 | ] 22 | ) 23 | } 24 | 25 | required init() { 26 | fatalError("init() has not been implemented") 27 | } 28 | } 29 | 30 | class ViewController: UIViewController, ARSessionDelegate { 31 | 32 | @IBOutlet var arView: ARView! 33 | 34 | @IBOutlet weak var toggleRobotButton: UIButton! 35 | @IBOutlet weak var jointNamePickerView: UIPickerView! 36 | 37 | // The 3D character to display. 38 | var character: BodyTrackedEntity? 39 | let characterOffset: SIMD3 = [0, 0, 0] // Offset the character by one meter to the left 40 | let characterAnchor = AnchorEntity() 41 | 42 | let sphereAnchor = AnchorEntity() 43 | var jointSpheres = [Entity]() 44 | var initalSpheresTransforms = [Transform]() 45 | var addSphereInterval = 0 46 | 47 | var jointDots = [CAShapeLayer]() 48 | 49 | var pickedJoints = [String: Entity]() 50 | var jointNames = [String]() 51 | 52 | var showRobot = false 53 | 54 | // A tracked raycast which is used to place the character accurately 55 | // in the scene wherever the user taps. 56 | var placementRaycast: ARTrackedRaycast? 57 | var tapPlacementAnchor: AnchorEntity? 58 | 59 | override func viewDidAppear(_ animated: Bool) { 60 | super.viewDidAppear(animated) 61 | 62 | jointNamePickerView.dataSource = self 63 | jointNamePickerView.delegate = self 64 | 65 | jointNames.append("Waiting for a body anchor..") 66 | jointNamePickerView.reloadAllComponents() 67 | 68 | 69 | arView.session.delegate = self 70 | 71 | // If the iOS device doesn't support body tracking, raise a developer error for 72 | // this unhandled case. 73 | guard ARBodyTrackingConfiguration.isSupported else { 74 | fatalError("This feature is only supported on devices with an A12 chip") 75 | } 76 | 77 | // Run a body tracking configration. 78 | let configuration = ARBodyTrackingConfiguration() 79 | arView.session.run(configuration) 80 | 81 | arView.scene.addAnchor(characterAnchor) 82 | arView.scene.addAnchor(sphereAnchor) 83 | 84 | // Asynchronously load the 3D character. 85 | var cancellable: AnyCancellable? = nil 86 | cancellable = Entity.loadBodyTrackedAsync(named: "character/robot").sink( 87 | receiveCompletion: { completion in 88 | if case let .failure(error) = completion { 89 | print("Error: Unable to load model: \(error.localizedDescription)") 90 | } 91 | cancellable?.cancel() 92 | }, receiveValue: { (character: Entity) in 93 | if let character = character as? BodyTrackedEntity { 94 | // Scale the character to human size 95 | character.scale = [1.0, 1.0, 1.0] 96 | self.character = character 97 | cancellable?.cancel() 98 | } else { 99 | print("Error: Unable to load model as BodyTrackedEntity") 100 | } 101 | }) 102 | } 103 | 104 | @IBAction func showAllJoints3D() { 105 | guard let anchors = arView.session.currentFrame?.anchors else {return} 106 | for anchor in anchors { 107 | if let bodyAnchor = anchor as? ARBodyAnchor, let character = character, character.jointNames.count == bodyAnchor.skeleton.jointModelTransforms.count { 108 | 109 | hideAllJoints3D() 110 | 111 | let bodyPosition = simd_make_float3(bodyAnchor.transform.columns.3) 112 | let bodyOrientation = Transform(matrix: bodyAnchor.transform).rotation 113 | 114 | for i in 0.. 0 { 252 | if addSphereInterval < 5 { 253 | addSphereInterval += 1 254 | } else { 255 | addSphereInterval = 0 256 | let sphereToAddIndex = abs(remainingSpheresToAdd - initalSpheresTransforms.count) 257 | let newSphere = CustomSphere(color: .blue, radius: 0.025) 258 | newSphere.transform = initalSpheresTransforms[sphereToAddIndex] 259 | sphereAnchor.addChild(newSphere, preservingWorldTransform: true) 260 | jointSpheres.append(newSphere) 261 | } 262 | } 263 | 264 | for i in 0.. 0 { 281 | for joint in pickedJoints { 282 | if let transform = bodyAnchor.skeleton.modelTransform(for: ARSkeleton.JointName(rawValue: joint.key)) { 283 | let position = bodyPosition + simd_make_float3(transform.columns.3) 284 | joint.value.position = position 285 | joint.value.orientation = bodyOrientation 286 | } 287 | } 288 | } 289 | } 290 | } 291 | } 292 | } 293 | 294 | extension BodyTrackedEntity { 295 | func jointName(forPath path: String) -> ARSkeleton.JointName { 296 | let splitPath = path.split(separator: "/") 297 | return ARSkeleton.JointName(rawValue: String(splitPath[splitPath.count - 1])) 298 | } 299 | } 300 | 301 | extension ViewController: UIPickerViewDataSource { 302 | func numberOfComponents(in pickerView: UIPickerView) -> Int { 303 | return 1 304 | } 305 | 306 | func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { 307 | return jointNames.count 308 | } 309 | 310 | func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { 311 | return jointNames[row] 312 | } 313 | 314 | func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { 315 | displayJoint(forName: jointNames[row]) 316 | } 317 | 318 | 319 | } 320 | 321 | extension ViewController: UIPickerViewDelegate { 322 | 323 | func pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat { 324 | return 60 325 | } 326 | 327 | } 328 | -------------------------------------------------------------------------------- /BodyDetection/character/robot.usdz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valengo/jointVisualizer/af2523737234c42e3131e772bda93c6bd1359e5a/BodyDetection/character/robot.usdz -------------------------------------------------------------------------------- /Configuration/SampleCode.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // See LICENSE folder for this sample’s licensing information. 3 | // 4 | // SampleCode.xcconfig 5 | // 6 | 7 | // The `SAMPLE_CODE_DISAMBIGUATOR` configuration is to make it easier to build 8 | // and run a sample code project. Once you set your project's development team, 9 | // you'll have a unique bundle identifier. This is because the bundle identifier 10 | // is derived based on the 'SAMPLE_CODE_DISAMBIGUATOR' value. Do not use this 11 | // approach in your own projects—it's only useful for sample code projects because 12 | // they are frequently downloaded and don't have a development team set. 13 | SAMPLE_CODE_DISAMBIGUATOR=${DEVELOPMENT_TEAM} 14 | -------------------------------------------------------------------------------- /LICENSE/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright © 2019 Apple Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Joint Visualizer 2 | An App to visualize the joints when capturing body motion with ARKit 3. 3 | 4 | ## Capturing Body Motion in 3D 5 | Track a person in the physical environment and visualize their motion by applying the same body movements to a virtual puppet. 6 | 7 | ## Overview 8 | - Note: This app was created using the sample code project that is associated with WWDC 2019 session [607: Bringing People into AR](https://developer.apple.com/videos/play/wwdc19/607/). 9 | 10 | - Note: To run the app, use an iOS device with A12 chip or later. 11 | --------------------------------------------------------------------------------