Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Official 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:
    3
    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...
     
  12. Tobias-Pott

    Tobias-Pott

    Joined:
    Aug 26, 2014
    Posts:
    12
    Although this thread is a bit old I wanted to give some feedback.

    @leweyg_unity It took quite some time for me to recognize that and find this thread. I wonder why the lack of simulating proxy forces isn't clearly stated. The guide only mentions to press play but doesn't clearly state that some things just are not available in simulation/device view.
    It would be helpful to have this mentioned somewhere more explicit as the forces feature is quite nice and I like the idea and what I imagine can be done with them. Could the docs be updated to include this info in the troubleshooting section (or something else)?
    It also would be cool to have it as a hint on objects in the editor while not in play mode but I understand that this might be a bit much to ask ^^

    Just took me quite some time to figure out that forces aren't broken and MARS not just sucks but I've been doing it wrong in relying on simulation and device view too much.

    Kind regards
    Tobias
     
  13. jmunozarUTech

    jmunozarUTech

    Unity Technologies

    Joined:
    Jun 1, 2020
    Posts:
    297
    Hello @Tobias-Pott !,

    Great catch!, and definitely something that would help users; I will make sure we add that note to the docs.

    Thanks for the feedback! :)