Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Unity Using ProxyForces in MARS

Discussion in 'Unity MARS' started by leweyg_unity, Jun 1, 2020.

  1. leweyg_unity

    leweyg_unity

    Unity Technologies

    Joined:
    Jan 29, 2020
    Posts:
    38
    One of the systems I'm most proud of in MARS is "Proxy Forces" for realtime dynamic placement of objects (combines springs and signed-distance-fields to bring objects into alignment with each other). You can find documentation and a video below. Glad to answer any questions, it is a new paradigm but hopefully really helps with the ergonomic aspects of AR interaction with the world.

    Docs: https://docs.unity3d.com/Packages/com.unity.mars@1.0/manual/Forces.html

    Early Video: https://drive.google.com/file/d/1kxRkocirkFOTjwzWTsdaQqq0S2HMBt3j/view



    Enjoy,
    -Lewey G. (Software Lead, MARS team)
     
  2. Jon-at-Kaio

    Jon-at-Kaio

    Joined:
    Oct 17, 2007
    Posts:
    185
    Here's a quick question on proxy forces. would I be able to use them to say snap planes at a given y height, to match the extents of a rooms wall ? So as to be able to generate a kind of floor plan ?
    (Love this entire toolset so far)
     
  3. leweyg_unity

    leweyg_unity

    Unity Technologies

    Joined:
    Jan 29, 2020
    Posts:
    38
    Hey @Jon-at-Kaio ,
    Yes you definitely could, sounds like you want to start with a vertical proxy then add a “Snap to Horizontal Surface” region pretty far below your object (and a “Snap to Vertical Surface” just behind it). That way you can tune the wall and floor distances separately.
     
  4. Jon-at-Kaio

    Jon-at-Kaio

    Joined:
    Oct 17, 2007
    Posts:
    185
    Not quite sure I'm understanding the layout of the hierarchy here? any chance of an exmaple?
     
  5. Jon-at-Kaio

    Jon-at-Kaio

    Joined:
    Oct 17, 2007
    Posts:
    185
    Or would landmarks be a better way of doing this, if so see my other post about landmark examples.
     
  6. leweyg_unity

    leweyg_unity

    Unity Technologies

    Joined:
    Jan 29, 2020
    Posts:
    38
    Hey @Jon-at-Kaio , here is a picture of the inspector setup. Easiest way to make this is via the MARS menus/inspectors: Vertical Proxy, then Forces / Snap to Vertical and Snap to Horizontal.
    Screen Shot 2020-06-17 at 10.02.06 AM.png Screen Shot 2020-06-17 at 10.01.31 AM.png
     
    jmunozarUTech likes this.
  7. Jon-at-Kaio

    Jon-at-Kaio

    Joined:
    Oct 17, 2007
    Posts:
    185
    Ahhh thanks I was trying to create child GOs with the forces on them. thanks
     
  8. juliannorum

    juliannorum

    Joined:
    Aug 14, 2018
    Posts:
    5
    can I somehow use this system to first snap to an image marker, then make it so the objects (once spawned) would have their alignment be based on the world understanding capabilities of ArKit4?
     
  9. leweyg_unity

    leweyg_unity

    Unity Technologies

    Joined:
    Jan 29, 2020
    Posts:
    38
    @juliannorum yes! The trick is to disable a couple of things:
    - On the "SetPoseAction" uncheck "Follow Match Updates" (so that if the marker placement updates, the object won't move with it)
    - If you used a "ProxyRegionForcePlane2D" to keep the object on a surface, then uncheck "KeepMatchPlane" so that it will try to position itself onto any plane (not just the initial matched plane).
     
  10. zerozerozero

    zerozerozero

    Joined:
    Mar 8, 2015
    Posts:
    2
    I'm trying to get an object to snap to the intersection of a floor and a wall. I add a Vertical Plane Proxy and a prefab as its child. I try to add a force: Add Force -> Snap to Horizontal Surfaces. The editor briefly flashes a component "Proxy Region Force Towards" in the inspector and a "Region Towards HorizontalUp" GameObject in the Content Hierarchy. These then disappear. I repeat the same process. This time the Component and the GameObject remain but as soon as I press Start Simulation they again disappear.
    This happens in both MARS 1.0 and 1.1 - what is going wrong?
     
  11. leweyg_unity

    leweyg_unity

    Unity Technologies

    Joined:
    Jan 29, 2020
    Posts:
    38
    @zerozerozero , so you do want to add the two "Snap to Vertical Surfaces" and "Snap to Horizontal Surfaces" preset Forces (which are both "Proxy Region Force Towards" components in the Inspector, but with the "Towards Alignment" configured differently for each, and each with their own cubic regions as children). For performance reasons Forces don't really preview in the Simulation Window, try it out in Play mode. Not sure about the flickering...
     
unityunity