Skip to content

Commit 4fe4aaa

Browse files
committed
Version 1.0.5
1 parent 61293ca commit 4fe4aaa

File tree

87 files changed

+652
-631
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+652
-631
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 1.0.5
4+
5+
* Fix Face detection and Body tracking deserialization errors
6+
* Add `ARKitSkeletonJointName` and helper methods for `ARKitSkeleton`
7+
* Add Body tracking sample
8+
39
## 1.0.4
410

511
* Add coaching overlay (by @HadiIOS)

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Result:
8383

8484
## Examples
8585

86-
I would highly recommend to review the [sample](https://github.com/olexale/arkit_flutter_plugin/blob/master/example/lib/main.dart) from the `Example` folder. You may find a couple of samples in the `Example` folder of the plugin. Some samples rely on [this Earth image](https://upload.wikimedia.org/wikipedia/commons/9/97/The_Earth_seen_from_Apollo_17.jpg)
86+
I would highly recommend to review the [sample](https://github.com/olexale/arkit_flutter_plugin/blob/master/example/lib/main.dart) from the `Example` folder inside the plugin. Some samples rely on [this Earth image](https://upload.wikimedia.org/wikipedia/commons/9/97/The_Earth_seen_from_Apollo_17.jpg)
8787

8888
| Name | Description | Link | Demo |
8989
|-------------|------------------------------------------------------|------------------------------------------------------|----|

analysis_options.yaml

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
include: package:pedantic/analysis_options.1.9.0.yaml
2-
3-
analyzer:
4-
exclude:
5-
# workaround for https://github.com/dart-lang/sdk/issues/42910
6-
- '**/*.g.dart'
1+
include: package:pedantic/analysis_options.1.9.0.yaml

build.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ targets:
33
builders:
44
json_serializable:
55
options:
6-
any_map: false
6+
any_map: true
77
checked: false
88
create_factory: true
99
create_to_json: true

example/ios/Flutter/AppFrameworkInfo.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>8.0</string>
24+
<string>9.0</string>
2525
</dict>
2626
</plist>

example/lib/body_tracking_page.dart

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import 'package:arkit_plugin/arkit_plugin.dart';
2+
import 'package:flutter/material.dart';
3+
import 'package:vector_math/vector_math_64.dart' as vector;
4+
5+
class BodyTrackingPage extends StatefulWidget {
6+
@override
7+
_BodyTrackingPageState createState() => _BodyTrackingPageState();
8+
}
9+
10+
class _BodyTrackingPageState extends State<BodyTrackingPage> {
11+
late ARKitController arkitController;
12+
ARKitNode? hand;
13+
14+
@override
15+
void dispose() {
16+
arkitController.dispose();
17+
super.dispose();
18+
}
19+
20+
@override
21+
Widget build(BuildContext context) => Scaffold(
22+
appBar: AppBar(title: const Text('Body Tracking Sample')),
23+
body: ARKitSceneView(
24+
configuration: ARKitConfiguration.bodyTracking,
25+
onARKitViewCreated: onARKitViewCreated,
26+
),
27+
);
28+
29+
void onARKitViewCreated(ARKitController arkitController) {
30+
this.arkitController = arkitController;
31+
this.arkitController.onAddNodeForAnchor = _handleAddAnchor;
32+
this.arkitController.onUpdateNodeForAnchor = _handleUpdateAnchor;
33+
}
34+
35+
void _handleAddAnchor(ARKitAnchor anchor) {
36+
if (!(anchor is ARKitBodyAnchor)) {
37+
return;
38+
}
39+
final transform =
40+
anchor.skeleton.modelTransformsFor(ARKitSkeletonJointName.leftHand);
41+
hand = _createSphere(transform!);
42+
arkitController.add(hand!, parentNodeName: anchor.nodeName);
43+
}
44+
45+
ARKitNode _createSphere(Matrix4 transform) {
46+
final position = vector.Vector3(
47+
transform.getColumn(3).x,
48+
transform.getColumn(3).y,
49+
transform.getColumn(3).z,
50+
);
51+
final material = ARKitMaterial(
52+
diffuse: ARKitMaterialProperty.color(Colors.red),
53+
);
54+
final sphere = ARKitSphere(materials: [material], radius: 0.05);
55+
56+
return ARKitNode(geometry: sphere, position: position);
57+
}
58+
59+
void _handleUpdateAnchor(ARKitAnchor anchor) {
60+
if (anchor is ARKitBodyAnchor && mounted) {
61+
final transform =
62+
anchor.skeleton.modelTransformsFor(ARKitSkeletonJointName.leftHand);
63+
hand?.transform = transform!;
64+
}
65+
}
66+
}

example/lib/main.dart

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:arkit_plugin_example/body_tracking_page.dart';
12
import 'package:arkit_plugin_example/check_support_page.dart';
23
import 'package:arkit_plugin_example/custom_animation_page.dart';
34
import 'package:arkit_plugin_example/custom_object_page.dart';
@@ -148,6 +149,13 @@ class MyApp extends StatelessWidget {
148149
() => Navigator.of(context)
149150
.push<void>(MaterialPageRoute(builder: (c) => FaceDetectionPage())),
150151
),
152+
Sample(
153+
'Body Tracking',
154+
'Red sphere that follows your hand.',
155+
Icons.person,
156+
() => Navigator.of(context)
157+
.push<void>(MaterialPageRoute(builder: (c) => BodyTrackingPage())),
158+
),
151159
Sample(
152160
'Panorama',
153161
'360 photo sample.',
@@ -194,7 +202,6 @@ class MyApp extends StatelessWidget {
194202

195203
return Scaffold(
196204
appBar: AppBar(
197-
brightness: Brightness.dark,
198205
title: const Text('ARKit Demo'),
199206
),
200207
body:

example/pubspec.yaml

+2-46
Original file line numberDiff line numberDiff line change
@@ -8,58 +8,14 @@ environment:
88
dependencies:
99
flutter:
1010
sdk: flutter
11-
collection: ^1.15.0
12-
13-
# The following adds the Cupertino Icons font to your application.
14-
# Use with the CupertinoIcons class for iOS style icons.
15-
cupertino_icons: ^0.1.2
1611

1712
dev_dependencies:
1813
flutter_test:
1914
sdk: flutter
20-
pedantic: ^1.11.0
15+
pedantic: ^1.11.1
2116

2217
arkit_plugin:
2318
path: ../
2419

25-
# For information on the generic Dart part of this file, see the
26-
# following page: https://www.dartlang.org/tools/pub/pubspec
27-
28-
# The following section is specific to Flutter.
2920
flutter:
30-
31-
# The following line ensures that the Material Icons font is
32-
# included with your application, so that you can use the icons in
33-
# the material Icons class.
34-
uses-material-design: true
35-
36-
# To add assets to your application, add an assets section, like this:
37-
# assets:
38-
# - images/a_dot_burr.jpeg
39-
# - images/a_dot_ham.jpeg
40-
41-
# An image asset can refer to one or more resolution-specific "variants", see
42-
# https://flutter.io/assets-and-images/#resolution-aware.
43-
44-
# For details regarding adding assets from package dependencies, see
45-
# https://flutter.io/assets-and-images/#from-packages
46-
47-
# To add custom fonts to your application, add a fonts section here,
48-
# in this "flutter" section. Each entry in this list should have a
49-
# "family" key with the font family name, and a "fonts" key with a
50-
# list giving the asset and other descriptors for the font. For
51-
# example:
52-
# fonts:
53-
# - family: Schyler
54-
# fonts:
55-
# - asset: fonts/Schyler-Regular.ttf
56-
# - asset: fonts/Schyler-Italic.ttf
57-
# style: italic
58-
# - family: Trajan Pro
59-
# fonts:
60-
# - asset: fonts/TrajanPro.ttf
61-
# - asset: fonts/TrajanPro_Bold.ttf
62-
# weight: 700
63-
#
64-
# For details regarding fonts from package dependencies,
65-
# see https://flutter.io/custom-fonts/#from-packages
21+
uses-material-design: true

lib/arkit_plugin.dart

+45-58
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,45 @@
1-
export 'package:arkit_plugin/arkit_node.dart';
2-
export 'package:arkit_plugin/arkit_reference_node.dart';
3-
export 'package:arkit_plugin/enums/coaching_overlay_goal.dart';
4-
export 'package:arkit_plugin/widget/ar_tracking_state.dart';
5-
export 'package:arkit_plugin/geometries/arkit_anchor.dart';
6-
export 'package:arkit_plugin/geometries/arkit_box.dart';
7-
export 'package:arkit_plugin/geometries/arkit_capsule.dart';
8-
export 'package:arkit_plugin/geometries/arkit_cone.dart';
9-
export 'package:arkit_plugin/geometries/arkit_cylinder.dart';
10-
export 'package:arkit_plugin/geometries/arkit_face.dart';
11-
export 'package:arkit_plugin/geometries/arkit_geometry.dart';
12-
export 'package:arkit_plugin/geometries/arkit_line.dart';
13-
export 'package:arkit_plugin/geometries/arkit_plane.dart';
14-
export 'package:arkit_plugin/geometries/arkit_pyramid.dart';
15-
export 'package:arkit_plugin/geometries/arkit_sphere.dart';
16-
export 'package:arkit_plugin/geometries/arkit_text.dart';
17-
export 'package:arkit_plugin/geometries/arkit_torus.dart';
18-
export 'package:arkit_plugin/geometries/arkit_tube.dart';
19-
export 'package:arkit_plugin/geometries/material/arkit_blend_mode.dart';
20-
export 'package:arkit_plugin/geometries/material/arkit_color_mask.dart';
21-
export 'package:arkit_plugin/geometries/material/arkit_cull_mode.dart';
22-
export 'package:arkit_plugin/geometries/material/arkit_fill_mode.dart';
23-
export 'package:arkit_plugin/geometries/material/arkit_lighting_model.dart';
24-
export 'package:arkit_plugin/geometries/material/arkit_material.dart';
25-
export 'package:arkit_plugin/geometries/material/arkit_material_property.dart';
26-
export 'package:arkit_plugin/geometries/material/arkit_transparency_mode.dart';
27-
export 'package:arkit_plugin/hit/arkit_hit_test_result.dart';
28-
export 'package:arkit_plugin/hit/arkit_hit_test_result_type.dart';
29-
export 'package:arkit_plugin/hit/arkit_node_pan_result.dart';
30-
export 'package:arkit_plugin/hit/arkit_node_pinch_result.dart';
31-
export 'package:arkit_plugin/hit/arkit_node_rotation_result.dart';
32-
export 'package:arkit_plugin/light/arkit_light.dart';
33-
export 'package:arkit_plugin/light/arkit_light_estimate.dart';
34-
export 'package:arkit_plugin/light/arkit_light_type.dart';
35-
export 'package:arkit_plugin/physics/arkit_physics_body.dart';
36-
export 'package:arkit_plugin/physics/arkit_physics_body_type.dart';
37-
export 'package:arkit_plugin/physics/arkit_physics_shape.dart';
38-
export 'package:arkit_plugin/widget/ar_environment_texturing.dart';
39-
export 'package:arkit_plugin/widget/arkit_arplane_detection.dart';
40-
export 'package:arkit_plugin/widget/arkit_configuration.dart';
41-
export 'package:arkit_plugin/widget/arkit_scene_view.dart';
42-
export 'package:arkit_plugin/widget/arkit_reference_image.dart';
43-
export 'package:arkit_plugin/widget/arkit_world_alignment.dart';
44-
45-
import 'package:arkit_plugin/widget/arkit_configuration.dart';
46-
import 'package:flutter/services.dart';
47-
48-
class ARKitPlugin {
49-
static const MethodChannel _channel = MethodChannel('arkit_configuration');
50-
51-
ARKitPlugin._();
52-
53-
static Future<bool> checkConfiguration(ARKitConfiguration configuration) {
54-
return _channel.invokeMethod<bool>('checkConfiguration', {
55-
'configuration': configuration.index,
56-
}).then((value) => value!);
57-
}
58-
}
1+
export 'package:arkit_plugin/src/arkit_node.dart';
2+
export 'package:arkit_plugin/src/arkit_plugin.dart';
3+
export 'package:arkit_plugin/src/arkit_reference_node.dart';
4+
export 'package:arkit_plugin/src/enums/arkit_skeleton_joint_name.dart';
5+
export 'package:arkit_plugin/src/enums/coaching_overlay_goal.dart';
6+
export 'package:arkit_plugin/src/widget/ar_tracking_state.dart';
7+
export 'package:arkit_plugin/src/geometries/arkit_anchor.dart';
8+
export 'package:arkit_plugin/src/geometries/arkit_box.dart';
9+
export 'package:arkit_plugin/src/geometries/arkit_capsule.dart';
10+
export 'package:arkit_plugin/src/geometries/arkit_cone.dart';
11+
export 'package:arkit_plugin/src/geometries/arkit_cylinder.dart';
12+
export 'package:arkit_plugin/src/geometries/arkit_face.dart';
13+
export 'package:arkit_plugin/src/geometries/arkit_geometry.dart';
14+
export 'package:arkit_plugin/src/geometries/arkit_line.dart';
15+
export 'package:arkit_plugin/src/geometries/arkit_plane.dart';
16+
export 'package:arkit_plugin/src/geometries/arkit_pyramid.dart';
17+
export 'package:arkit_plugin/src/geometries/arkit_sphere.dart';
18+
export 'package:arkit_plugin/src/geometries/arkit_text.dart';
19+
export 'package:arkit_plugin/src/geometries/arkit_torus.dart';
20+
export 'package:arkit_plugin/src/geometries/arkit_tube.dart';
21+
export 'package:arkit_plugin/src/geometries/material/arkit_blend_mode.dart';
22+
export 'package:arkit_plugin/src/geometries/material/arkit_color_mask.dart';
23+
export 'package:arkit_plugin/src/geometries/material/arkit_cull_mode.dart';
24+
export 'package:arkit_plugin/src/geometries/material/arkit_fill_mode.dart';
25+
export 'package:arkit_plugin/src/geometries/material/arkit_lighting_model.dart';
26+
export 'package:arkit_plugin/src/geometries/material/arkit_material.dart';
27+
export 'package:arkit_plugin/src/geometries/material/arkit_material_property.dart';
28+
export 'package:arkit_plugin/src/geometries/material/arkit_transparency_mode.dart';
29+
export 'package:arkit_plugin/src/hit/arkit_hit_test_result.dart';
30+
export 'package:arkit_plugin/src/hit/arkit_hit_test_result_type.dart';
31+
export 'package:arkit_plugin/src/hit/arkit_node_pan_result.dart';
32+
export 'package:arkit_plugin/src/hit/arkit_node_pinch_result.dart';
33+
export 'package:arkit_plugin/src/hit/arkit_node_rotation_result.dart';
34+
export 'package:arkit_plugin/src/light/arkit_light.dart';
35+
export 'package:arkit_plugin/src/light/arkit_light_estimate.dart';
36+
export 'package:arkit_plugin/src/light/arkit_light_type.dart';
37+
export 'package:arkit_plugin/src/physics/arkit_physics_body.dart';
38+
export 'package:arkit_plugin/src/physics/arkit_physics_body_type.dart';
39+
export 'package:arkit_plugin/src/physics/arkit_physics_shape.dart';
40+
export 'package:arkit_plugin/src/widget/ar_environment_texturing.dart';
41+
export 'package:arkit_plugin/src/widget/arkit_arplane_detection.dart';
42+
export 'package:arkit_plugin/src/widget/arkit_configuration.dart';
43+
export 'package:arkit_plugin/src/widget/arkit_scene_view.dart';
44+
export 'package:arkit_plugin/src/widget/arkit_reference_image.dart';
45+
export 'package:arkit_plugin/src/widget/arkit_world_alignment.dart';

lib/geometries/arkit_skeleton.dart

-23
This file was deleted.

0 commit comments

Comments
 (0)