Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Can only use Pose to update 1 object

Discussion in 'AR' started by SerializeField, May 23, 2019.

  1. SerializeField

    SerializeField

    Joined:
    May 22, 2017
    Posts:
    22
    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. SerializeField

    SerializeField

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