Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Can only use Pose to update 1 object

Discussion in 'Handheld AR' started by Letail, May 23, 2019.

  1. Letail

    Letail

    Joined:
    May 22, 2017
    Posts:
    5
    Hi,

    I am building an Android App. I want to update two gameobject to the same pose, generated by a raycast into a surface.

    The following line of code works and updates my GameObject's position on a plane:

    Code (CSharp):
    1. placementIndicator.transform.SetPositionAndRotation(placementPose.position, placementPose.rotation);
    however, if I try to do the following, only the first GameObject updates:

    Code (CSharp):
    1. placementIndicator.transform.SetPositionAndRotation(placementPose.position, placementPose.rotation);
    2. marker.transform.SetPositionAndRotation(placementPose.position, placementPose.rotation);
    Any idea as to why this might be?

    On a second note,
    I am using a line renderer to visualize the distance between the marker and some value.
    Code (CSharp):
    1. point01 = placementPose.position + placementPose.up * distanceFromCamera;
    2.  
    3. points[0] = placementIndicator.transform.position;
    4. points[1] = point01;
    5. placementIndicatorLine.SetPositions(points);
    This works as expected. I can increase and decrease this vertical line.
    However, if I try to set a GameObject's positon to
    point01
    it doesn't work.

    Any help?
    I am using 2019.1.3f1, AR Foundation 2.1.0, ARCore XR Plugin 2.1.0.
     
  2. Letail

    Letail

    Joined:
    May 22, 2017
    Posts:
    5
    Ok, so I restarted Unity and un-checked Development Build on Build Settings and now this works perfectly.