Log in or register to post comments

using terrain in scene

April 7, 2014 - 6:02am #1

Hi

I'm trying to show a house & a terrain on my image target. but when i play the scene the terrain doesnt stick on image target like the house. what should i do?

Thanks for your help 

AttachmentSize
Image icon johnjohnahk1.jpg161.02 KB
Image icon johnjohnahk2.jpg198.18 KB

using terrain in scene

August 27, 2020 - 6:14am #11

Hi, this is still not solved. Changing static setting did not help. Tested with v 9.3.3 on Unity 2019.3

using terrain in scene

January 30, 2017 - 5:11am #10

Hi

 

Did you ever find a solution for this problem?

I am having probably the same issue. Can see my terrain and objects, but they are not aligned, object is aligned with target picture and moves nicely when I move picture, terrain moved with picture but does not rotate.

 

Any help would be much appreciated

using terrain in scene

April 8, 2014 - 11:44am #9

Go ahead and uncheck the Static option for the Terrain and view the results in Play Mode.

using terrain in scene

April 8, 2014 - 10:48am #8

No. look at the attached image

AttachmentSize
Image icon johnjohnahk3.jpg149.7 KB

using terrain in scene

April 7, 2014 - 3:49pm #7

Is the Static check box for the terrain object turned off in the Inspector?

using terrain in scene

April 7, 2014 - 12:02pm #6

you know, its wonderfull for me. because i do all of this and the result is different. thank you

whoulyou p;ease take a look on my project? if it doesnt bother you. thank you

my project    (its only 12 mb)

using terrain in scene

April 7, 2014 - 8:17am #5

I have just tried the following:

- Image Target with DefaultTrackableEventHandler.cs attached to it (withou any custom code, just the default script)

- Create terrain game object and attach it as child of Image target

- Adjust the terrain settings so that is is a bit smaller (defalt Terrain has a mesh 2000 x 2000, which is a bit big...   I reduced it to 200 x 200)

- Run the sample

The terrain augmentation looks stable and well aligned with the target, see screenshot attached.

 

AttachmentSize
Image icon terrain_aug.png273.98 KB

using terrain in scene

April 7, 2014 - 7:22am #4

Its my DefaultTrackableEventHandler.cs.  Is it relevant؟ :

/*==============================================================================
Copyright (c) 2010-2013 Qualcomm Connected Experiences, Inc.
All Rights Reserved.
Confidential and Proprietary - Qualcomm Connected Experiences, Inc.
==============================================================================*/

using UnityEngine;

/// <summary>
/// A custom handler that implements the ITrackableEventHandler interface.
/// </summary>
public class DefaultTrackableEventHandler : MonoBehaviour,
                                            ITrackableEventHandler
{
    #region PRIVATE_MEMBER_VARIABLES
 
    private TrackableBehaviour mTrackableBehaviour;
    
    #endregion // PRIVATE_MEMBER_VARIABLES



    #region UNTIY_MONOBEHAVIOUR_METHODS
    
    void Start()
    {
        mTrackableBehaviour = GetComponent<TrackableBehaviour>();
        if (mTrackableBehaviour)
        {
            mTrackableBehaviour.RegisterTrackableEventHandler(this);
        }
    }

    #endregion // UNTIY_MONOBEHAVIOUR_METHODS



    #region PUBLIC_METHODS

    /// <summary>
    /// Implementation of the ITrackableEventHandler function called when the
    /// tracking state changes.
    /// </summary>
    public void OnTrackableStateChanged(
                                    TrackableBehaviour.Status previousStatus,
                                    TrackableBehaviour.Status newStatus)
    {
        if (newStatus == TrackableBehaviour.Status.DETECTED ||
            newStatus == TrackableBehaviour.Status.TRACKED ||
            newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED)
        {
            OnTrackingFound();
        }
        else
        {
            OnTrackingLost();
        }
    }

    #endregion // PUBLIC_METHODS



    #region PRIVATE_METHODS


      private void OnTrackingFound()
    {
        Renderer[] rendererComponents = GetComponentsInChildren<Renderer>();
        Collider[] colliderComponents = GetComponentsInChildren<Collider>();
        Terrain[] terrainComponents = GetComponentsInChildren<Terrain>();
        
        foreach(Terrain component in terrainComponents )
        {
            component.enabled = true;
        }
        // Enable rendering:
        foreach (Renderer component in rendererComponents)
        {
            component.enabled = true;
        }
        // Enable colliders:
        foreach (Collider component in colliderComponents)
        {
            component.enabled = true;
        }
        Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " found");
    }
    private void OnTrackingLost()
    {
        Renderer[] rendererComponents = GetComponentsInChildren<Renderer>();
        Collider[] colliderComponents = GetComponentsInChildren<Collider>();
        Terrain[] terrainComponents = GetComponentsInChildren<Terrain>();
        
        foreach(Terrain component in terrainComponents )
        {
            component.enabled = false;
        }
        // Disable rendering:
        foreach (Renderer component in rendererComponents)
        {
            component.enabled = false;
        }
        // Disable colliders:
        foreach (Collider component in colliderComponents)
        {
            component.enabled = false;
        }
        Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " lost");
    }

    #endregion // PRIVATE_METHODS
}

 

using terrain in scene

April 7, 2014 - 7:11am #3

1-I draged & deopped the terrain in image target from Hierarchy. isnt it enough to make the terrain the child of image target?

2-What kind of setting or behaviour should I check? I made a terrain from gameobject>create other>terrain & I havent used any additional setting or script.

Excuse me because of my poor English :) Thank you

using terrain in scene

April 7, 2014 - 6:09am #2

1. - Make sure that both the terrain and the house are children of the Image Target.

2.  Check if the terrain object has any special behaviour or special settings that override the transform component.

Log in or register to post comments