How to interact with the Ball Pit Sample Scene
The following is a walk through for playing the Ball Pit Sample scene on a compatible device. The purpose of this sample is to demonstrate real time mesh generation along with object occlusion and physics interaction with the mesh.
How to start the Sample App
Open 6DSDKSampleApp. The app will have the 6D logo.
On the first launch, a pop-up will ask you to authorize usage of the phone's camera; another pop-up will also ask you to authorize usage of location data.
Open the Ball Pit scene
Let's have some fun
The scene presents itself as a camera viewport with a mesh toggle button filter_hdr, enabled by default.
Immediately after the scene starts, a colored tint starts spreading over objects: that's the real time world mesh.
Toss balls by tapping the screen anywhere. The ball will be instantiated at that position, and a force in the z direction will be added. We didn't add force customization but feel free to experiment.
You can also toggle the mesh filter_hdr to make the mesh rendering disappear to get a more lifelike feel to the pseudo-game.
This scene also supports occlusion (a real life object blocking the digital objects).
The balls also cast shadows on the surface they are on.
There is a limit of thirty balls that can be instantiated before they start getting recycled (older ones get deleted). You can up this limit through Unity. The purpose of this example is to show physics and interactions with the real world, have fun!
Relocalization with saved mesh data
Starting with SDK version 0.17.0, relocalization and loading of previously saved meshes is now possible. A few notes about how this system currently works so that developers understand how to use it. We still have many improvements to come around mesh merging, and will update this page and release notes as functionality is updated.
- It is important to always start an app session by downloading any currently saved meshes via the download button cloud_download (
SixDegreesSDK_LoadFromARCloud()). The app will automatically attempt to relocalize across all saved maps that exist for your current location. This process will timeout after 30 secs, but you can stop it early with
- After a successful relocalization, you will notice that any mesh you had been building locally is cleared from memory and the downloaded mesh corresponding to your current location is drawn. The SDK will immediately start to add to this mesh as you move around.
- Skip to step 3 if relocalization doesn’t succeed, map data is not available at your location, or if you just want to start from scratch.
- After you have built up some additional mesh data, use the upload button cloud_upload (
SixDegreesSDK_SaveToARCloud()) to add your newly collected mesh to the stored maps in the 6D Reality Platform. Note that map data size increases linearly with usage, making file transfer more significant when calling
SixDegreesSDK_SaveToARCloud()- essentially each map you upload is saved, and the database of all saved maps is transferred back and forth with each upload/download action.
warning During an app session, if you upload before you have downloaded or relocalized, your upload will be used to replace any existing stored maps for your location. This functionality is added to enable developers to easily clean out old saved maps during testing and will not function this way once we get to a general release candidate.