Skip to content

Commit 3c98677

Browse files
authored
Add files via upload
1 parent ef373cc commit 3c98677

10 files changed

+1171
-0
lines changed

WalkingDollar/source/Assembly-CSharp-Editor.csproj

Lines changed: 375 additions & 0 deletions
Large diffs are not rendered by default.

WalkingDollar/source/Assembly-CSharp.csproj

Lines changed: 436 additions & 0 deletions
Large diffs are not rendered by default.

WalkingDollar/source/LICENSE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
All contents of this repository except for the contents of the /Assets/UnityARKitPlugin/Examples/FaceTracking/SlothCharacter folder and its subfolders are released under the MIT License, which is listed under /LICENSES/MIT_LICENSE file.
2+
3+
Contents of the /Assets/UnityARKitPlugin/Examples/FaceTracking/SlothCharacter folder and its subfolders are released under the Unity Companion License, which is listed under /LICENSES/UCL_LICENSE file.
4+

WalkingDollar/source/README.md

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
# Unity-ARKit-Plugin [Now deprecated as of June 3, 2019]#
2+
3+
## This plugin has been deprecated. Please use [AR Foundation](https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@latest?preview=1) in order to access the latest features of ARKit.
4+
5+
[**Latest Update:** This plugin now supports new ARKit functionality exposed in ARKit 2.0. See [Whats New In ARKit 2.0](./docs/WhatsNewInARKit2_0.md) for details.]
6+
7+
This is a native [Unity](https://unity3d.com/) plugin that exposes the functionality of Apple’s
8+
[ARKit SDK](https://developer.apple.com/arkit/) to your Unity projects for compatible iOS devices. Includes ARKit features such as world tracking, pass-through camera rendering, horizontal and vertical plane detection and
9+
update, face tracking (requires iPhone X), image anchors, point cloud extraction, light estimation, and hit testing API to Unity developers for their AR projects. This plugin is a _preview quality_ build that
10+
will help you get up and running quickly, but the implementation and APIs are subject to change. Nevertheless, it is quite capable of creating a full featured ARKit app, and hundreds of ARKit apps on the AppStore already use this plugin.
11+
12+
Please read [LICENSE](./LICENSE) for licensing information.
13+
14+
The code drop is a Unity project, compatible with Unity 2017.4 and later. It contains the plugin sources, example scenes, and components that you may use in your own projects. See [TUTORIAL.txt](./TUTORIAL.txt) for detailed setup instructions.
15+
16+
Please feel free to extend the plugin and send pull requests. You may also provide feedback if you would like improvements or want to suggest changes. Happy coding and have fun!
17+
18+
19+
## Requirements: ##
20+
* [Unity](https://unity3d.com/get-unity/download) v2017.4+
21+
* Apple [Xcode](https://developer.apple.com/xcode/) 10.0+ with latest iOS SDK that contains ARKit Framework
22+
* Apple iOS device that supports ARKit (iPhone 6S or later, iPad (2017) or later)
23+
* Apple [iOS 12](https://www.apple.com/ios/ios-12/)+ installed on device
24+
25+
## Building ##
26+
27+
Give it a go yourself. Open up
28+
[UnityARKitScene.unity](./Assets/UnityARKitPlugin/Examples/UnityARKitScene/UnityARKitScene.unity)
29+
— a scene that demostrates ARKit’s basic functionality —
30+
and try building it to iOS.
31+
Note that
32+
[UnityARBuildPostprocessor.cs](./Assets/UnityARKitPlugin/Plugins/iOS/UnityARKit/Editor/UnityARBuildPostprocessor.cs)
33+
is an editor script that executes at build time, and does some modifications to the XCode project that is exported by Unity. You could also try building the other example scenes in the subfolders of the [Examples](./Assets/UnityARKitPlugin/Examples/) folder.
34+
35+
36+
## API overview ##
37+
38+
39+
[UnityARSessionNativeInterface.cs](./Assets/UnityARKitPlugin/Plugins/iOS/UnityARKit/NativeInterface/UnityARSessionNativeInterface.cs)
40+
implements the following:
41+
42+
```CSharp
43+
public void RunWithConfigAndOptions( ARKitWorldTackingSessionConfiguration config, UnityARSessionRunOption runOptions )
44+
public void RunWithConfig( ARKitWorldTackingSessionConfiguration config )
45+
public void Pause()
46+
public List<ARHitTestResult> HitTest( ARPoint point, ARHitTestResultType types )
47+
public ARTextureHandles GetARVideoTextureHandles()
48+
public float GetARAmbientIntensity()
49+
public int GetARTrackingQuality()
50+
```
51+
52+
53+
54+
55+
It also contains events that you can provide these delegates for:
56+
57+
```CSharp
58+
public delegate void ARFrameUpdate( UnityARCamera camera )
59+
60+
public delegate void ARAnchorAdded( ARPlaneAnchor anchorData )
61+
public delegate void ARAnchorUpdated( ARPlaneAnchor anchorData )
62+
public delegate void ARAnchorRemoved( ARPlaneAnchor anchorData )
63+
64+
public delegate void ARUserAnchorAdded(ARUserAnchor anchorData)
65+
public delegate void ARUserAnchorUpdated(ARUserAnchor anchorData)
66+
public delegate void ARUserAnchorRemoved(ARUserAnchor anchorData)
67+
68+
public delegate void ARFaceAnchorAdded(ARFaceAnchor anchorData)
69+
public delegate void ARFaceAnchorUpdated(ARFaceAnchor anchorData)
70+
public delegate void ARFaceAnchorRemoved(ARFaceAnchor anchorData)
71+
72+
public delegate void ARImageAnchorAdded(ARImageAnchor anchorData)
73+
public delegate void ARImageAnchorUpdated(ARImageAnchor anchorData)
74+
public delegate void ARImageAnchorRemoved(ARImageAnchor anchorData)
75+
76+
public delegate void ARSessionFailed( string error )
77+
public delegate void ARSessionCallback();
78+
public delegate void ARSessionTrackingChanged(UnityARCamera camera)
79+
80+
```
81+
82+
These are the list of events you can subscribe to:
83+
84+
```CSharp
85+
public static event ARFrameUpdate ARFrameUpdatedEvent;
86+
87+
public static event ARAnchorAdded ARAnchorAddedEvent;
88+
public static event ARAnchorUpdated ARAnchorUpdatedEvent;
89+
public static event ARAnchorRemoved ARAnchorRemovedEvent;
90+
91+
public static event ARUserAnchorAdded ARUserAnchorAddedEvent;
92+
public static event ARUserAnchorUpdated ARUserAnchorUpdatedEvent;
93+
public static event ARUserAnchorRemoved ARUserAnchorRemovedEvent;
94+
95+
public static event ARFaceAnchorAdded ARFaceAnchorAddedEvent;
96+
public static event ARFaceAnchorUpdated ARFaceAnchorUpdatedEvent;
97+
public static event ARFaceAnchorRemoved ARFaceAnchorRemovedEvent;
98+
99+
public static event ARImageAnchorAdded ARImageAnchorAddedEvent;
100+
public static event ARImageAnchorUpdated ARImageAnchorUpdatedEvent;
101+
public static event ARImageAnchorRemoved ARImageAnchorRemovedEvent;
102+
103+
public static event ARSessionFailed ARSessionFailedEvent;
104+
public static event ARSessionCallback ARSessionInterruptedEvent;
105+
public static event ARSessionCallback ARSessioninterruptionEndedEvent;
106+
public static event ARSessionTrackingChanged ARSessionTrackingChangedEvent;
107+
```
108+
109+
[ARSessionNative.mm](./Assets/UnityARKitPlugin/Plugins/iOS/UnityARKit/NativeInterface/ARSessionNative.mm) contains Objective-C code for directly interfacing with the ARKit SDK.
110+
111+
All C# files in the [NativeInterface](./Assets/UnityARKitPlugin/Plugins/iOS/UnityARKit/NativeInterface/) folder beginning with “AR” are the scripting API equivalents of data structures exposed by ARKit.
112+
113+
114+
## ARKit useful components ##
115+
116+
**Physical camera feed**. Place this component on the physcial camera object. It will grab the textures needed for rendering the video, set it on the material needed for blitting to the backbuffer, and set up the command buffer to do the actual blit.
117+
[UnityARVideo.cs](./Assets/UnityARKitPlugin/Plugins/iOS/UnityARKit/Helpers/UnityARVideo.cs)
118+
119+
**Virtual camera manager**. Place this component on a GameObject in the scene that references the virtual camera that you intend to control via ARKit.
120+
It will position and rotate the camera as well as provide the correct projection matrix to it based on updates from ARKit.
121+
This component also has the code to initialize an ARKit session.
122+
[UnityARCameraManager.cs](./Assets/UnityARKitPlugin/Plugins/iOS/UnityARKit/Helpers/UnityARCameraManager.cs)
123+
124+
**Plane anchor GameObjects**. For each plane anchor detected, this component generates a GameObject which is instantiated from a referenced prefab and positioned, scaled and rotated according to plane detected. As the plane anchor updates and is removed, so is the corresponding GameObject. [UnityARGeneratePlane.cs](./Assets/UnityARKitPlugin/Plugins/iOS/UnityARKit/Helpers/UnityARGeneratePlane.cs)
125+
126+
**Point cloud visualizer**. This component references a particle system prefab, maximum number of particles and size per particle to be able to visualize the point cloud as particles in space. [PointCloudParticleExample.cs](./Assets/UnityARKitPlugin/Plugins/iOS/UnityARKit/Helpers/PointCloudParticleExample.cs)
127+
128+
**Hit test**. This component references the root transform of a GameObject in the scene, and does an ARKit Hit Test against the scene wherever user touches on screen, and when hit successful (against HitTest result types enumerated in the script), moves the referenced GameObject to that hit point. [UnityARHitTestExample.cs](./Assets/UnityARKitPlugin/Plugins/iOS/UnityARKit/Helpers/UnityARHitTestExample.cs)
129+
130+
**Light estimation**. This component when added to a light in the scene will scale the intensity of that light to the estimated lighting in the real scene being viewed. [UnityARAmbient.cs](./Assets/UnityARKitPlugin/Plugins/iOS/UnityARKit/Helpers/UnityARAmbient.cs)
131+
132+
You can read how some of these components are used in the [Examples](./Assets/UnityARKitPlugin/Examples/) scenes by checking out [SCENES.txt](./SCENES.txt).
133+
134+
135+
## Feature documentation ##
136+
137+
As newer features have been added on to the plugin, they have been documented in detail elsewhere. Here are links to those documents:
138+
139+
### Unity ARKit Remote ###
140+
141+
[“Introducing the Unity ARKit Remote”](https://blogs.unity3d.com/2017/08/03/introducing-the-unity-arkit-remote/)
142+
143+
[“ARKit Remote: Now with face tracking!"](https://blogs.unity3d.com/2018/01/16/arkit-remote-now-with-face-tracking/)
144+
145+
146+
### Face tracking ###
147+
148+
[“ARKit Face Tracking on iPhone X.”](https://blogs.unity3d.com/2017/11/03/arkit-face-tracking-on-iphone-x/)
149+
(Yes—It requires an [iPhone X](https://www.apple.com/iphone-x/).)
150+
151+
["Create your own animated emojis with Unity!"](https://blogs.unity3d.com/2017/12/03/create-your-own-animated-emojis-with-unity/)
152+
153+
### Plugin Settings file ###
154+
155+
["ARKit uses Face Tracking API"](https://forum.unity.com/threads/submitting-arkit-apps-to-appstore-without-face-tracking.504572/#post-3297235)
156+
157+
["App requires ARKit device"](https://forum.unity.com/threads/arkit-support-for-ios-via-unity-arkit-plugin.474385/page-43#post-3297582)
158+
159+
### ARKit 1.5 Update ###
160+
161+
Unity blog post ["Developing for ARKit 1.5 update using Unity ARKit Plugin"](https://blogs.unity3d.com/2018/02/16/developing-for-arkit-1-5-update-using-unity-arkit-plugin/)
162+
163+
### ARKit 2.0 Update ###
164+
165+
How to use new features from Unity: [Whats New In ARKit 2.0](./docs/WhatsNewInARKit2_0.md)
166+
167+
### ARKit 3 ###
168+
169+
This plugin will not be updated to support ARKit 3 features. Please use [AR Foundation](https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@latest?preview=1) in order to access all ARKit features going forward.
170+
171+
## Questions? Bugs? Showcase? ##
172+
173+
Contact us via the [forums](https://forum.unity.com/forums/arkit.139/) for questions.
174+
175+
You may submit [issues](https://bitbucket.org/Unity-Technologies/unity-arkit-plugin/issues?status=new&status=open) if you feel there are bugs that are not solved by asking on the forums.
176+
177+
You may submit a [pull request](https://bitbucket.org/Unity-Technologies/unity-arkit-plugin/pull-requests/) if you believe you have a useful enhancement for this plugin.
178+
179+
Follow [@jimmyjamjam](https://twitter.com/jimmy_jam_jam) for various AR related tweets, and showcase your creation there as well.

WalkingDollar/source/SCENES.txt

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Example Scenes in Project:
2+
3+
UnityARKitScene.unity: This scene is a "minimal" scene that shows most of the ARKit functionality
4+
5+
It has a GameObject (GO) called ARCameraManager which has the script UnityARCameraManager.cs, and has a reference to the Main Camera in the scene. On startup, this script initializes the ARKit and updates the camera position, rotation and projectionMatrix based on the information updated per frame by the ARKit.
6+
7+
The Main Camera has a script on it called UnityARVideo.cs, which updates the live video using a reference to a YUVMaterial which contains a shader to carry out the rendering of the video.
8+
9+
There is a GO called RandomCube that is the checkerboard cube in the scene that is placed at 1 unit in the z direction from the origin of the scene. Since our tracking begins with the Main Camera position and rotation set at the origin, when you startup the scene you should be able to see a checkered cube 1 meter straight in front of you.
10+
11+
There is a GO called GeneratePlanes which has UnityARGeneratePlane script which on it which references a prefab to display the generated planes. The script hooks into the horizontal plane detection and update events that ARKit signals so that every new plane detected gets a corresponding instance of the prefab placed in the world. It uses some utility scripts to keep track of the planes detected and to generate the instances. As you scan the scene, this GO should generate an instance of the prefab you have referenced from it each time ARKit detects a plane, and it will update the extents and orientation of the prefab instance based on the plane update events.
12+
13+
There is a GO called HitCube which has a script called UnityARHitTestExample which references the parent transform. The script does a ARKit hit test whenever a touch is detected on the screen, and the resulting position of the hit test result is used to place the parent transform of the cube. When running the scene, touching on the screen would move the HitCube to where your touch intersected a plane, or if a plane was not hit, the nearest feature point.
14+
15+
There is a GO called PointCloudParticleExample which has a script of the same name, which gets the point cloud data from ARKit, and displays a particle per point data in the cloud. This shows in the scene as little yellow dots.
16+
17+
The Directional Light in the scene has a UnityARAmbient script on it, which uses ARKit light estimation value to change the intensity of the light. So if you go into a dark room, the objects in the scene will be lit with a less bright light than if you were in daylight.
18+
19+
20+
UnityParticlePainter.unity: This scene is a sample that allows you to paint particles into your scene to augment your surroundings.
21+
22+
The UnityARCameraManager script is setup the same as way as in the minimal scene.
23+
The main script used to implement the painting functionality is ParticlePainter.cs. The way it works: it has three modes of painting through which you can cycle as many times as you want using the button on the top right. The first mode is "OFF", which allows you to navigate through the scene using the phone so that you can examine your artistic masterpiece. The second mode is "PICK", which brings up a color picker from which you can pick the color of the paint you will use. The third mode is "PAINT", which allows you to move the phone around and cause the app to leave particles of the picked color behind in the world. This will continuously generate particles that as long as you move more than a certain threshold distance. After you have painted, or if you want to start a new section of paint or a new color, press the button again the required number of times to get to the mode you need.
24+
25+
There is some external source for HSVPicker that was used for this example: https://github.com/judah4/HSV-Color-Picker-Unity
26+
27+
UnityARBallz.unity: This scene shows how to use colliders and rigidbodies with your augmented scene.
28+
29+
Similar setup to original scene, with GeneratePlanes GO generating horizontal planes with collider that approximate horizontal surfaces discovered. BallMaker script will generate "Ball" prefabs that are rigidbodies with speherical colliders that interact with each other as well as the planes that have been generated. BallMover script generates a collider where your finger touches the plane, so that you can move the balls in the vicinity.
30+
31+
UnityARShadows.unity: This scene shows how to use a material that can render shadows on real objects (mainly planes in this example) by using a shader that combines shadowmapping with blending.
32+
33+
The main change is the GeneratePlane GO creates instances of the shadowPlanePrefab that uses the shadowPlaneMaterial, which in turn uses MobileARShadow.shader. You could also use this material on a plane that is attached to the foot of the object you want to create the shadow. When running the scene, detect a plane, and use the hittest to place a "player" object on the plane. The player object will display a shadow on the plane.
34+
35+
UnityAROcclusion.unity: This scene shows how to occlude virtual objects by using an occluder material.
36+
37+
GeneratePlanes GO now creates instances of an occluderPlanePrefab which uses uses an occlusionPlaneMaterial, which in turn uses a MobileOcclusion.shader. The material has its renderqueue set to "Geometry-10", and so renders before any other geometry in the scene. The shader then writes to the depth buffer only, so any objects rendered behind this object will be rejected by the ztest and not render.
38+
39+
40+
UnityARUserAnchorScene: This scene is an example of how someone could use the add/removeAnchor API. As you tap around in the world, a checkered cube will be added 1 meter away from the front vector of the camera. The cubes will start to disapear after 4 seconds.
41+
42+
A new component exists named UnityARUserAnchorComponent that you can add to GameObjects. This component will automatically add/remove anchors to/from ARKit based on the object's lifecycle.
43+

0 commit comments

Comments
 (0)