Missing content/object placement options

Is there a way place content with for expample a tap to place gesture? What would be the best way to implement here in MARS. At the moment content will place as soon as the conditions are met.

1 Like

Our recommended method for this is to check for taps on a replicated proxy or visualized plane. The game sample does tap detection for maneuvering the robot character - you should be able to adapt that code for placing content. This isn’t the first time we’ve had this request - we will be pulling that out into a separate template or prefab so there is a one-click answer.

How do we get plane data ? something like AR foundation ( planewithpolygon)

Regarding how to get plane data, two main ways:

  • The “MARSPlaneVisualizer” if you want all the raw planes (add
    IUsesPlaneFinding, then call "
    this.SubscribePlaneAdded/Updated/Removed" to get callbacks). NOTE: not associated with a proxy.

  • The ShowChildrenInBoundsAction way (a Proxy Action behavior with IMatchVisibilityHandler, then add
    IUsesMARSTrackableData, and call "
    var mrPlane = queryResult.ResolveValue(this);")

Hope that helps!
-Lewey G.

3 Likes

To follow up on @leweyg_unity 's reply, using IMatchVisibilityHandler is not necessary for this - the important interface is IUsesMARSTrackableData which allows you to call ResolveValue(this) on a QueryResult.

A good starting point would be to look at BuildSurfaceAction, which creates a mesh from plane data and can assign this mesh to a MeshCollider on the same game object. You can either copy this script and write a custom action out of it, or write a manager script that checks for taps on replicated Proxies with BuildSurfaceAction. If you have a reference to a Proxy that uses plane data you can get its current plane data by implementing IUsesMARSTrackableData and using proxy.currentData.ResolveValue(this).

2 Likes

An object placement example would be nice.

The Ikea-style ecommerce product placement is extremely important for people to adopt MARS.

If you also worked in an asset streaming “Addressables” example ontop of that, we can have it to where people are streaming their 3d assets from their woocommerce wordpress installation. A lot of people would like to just update their products on their webserver, instead of rebuild their app everytime they get/change a product.

Streaming an ecommerce 3d model from a webserver, into a unity app, to be placed on an AR plane in MARS; would be astronomical.

Their 3d content would be hosted on their ecommerce cms, as well as streaming into their custom app built on Unity for AR.

Google will be indexing 3d models from websites and placing them into the SERP here soon, so having these 3d assets hosted on the webserver will be extremely beneficial.

1 Like

@Blarp with regards to object placement; you could checkout @leweyg_unity 's reply in Raycast in Unity MARS for using a “MARS Plane Visualizer” and just customizing the “Plane Prefab” to support collision detection to place your content.

1 Like

See this thread: MARS Direct Placement Example for a template that adds placement via raycasting with an indicator.

1 Like

@Blarp -_- thx for the virus you sent to my inbox luckily Im an IT expert and could’ve took matters into my own hands but its 2020 and two wrongs don’t make a right so ill just report you. Stop trying to make an iPhone hacking program using unity. its sad.