0

I am spawning a player object on a Mapbox 3D terrain map. I need to spawn this object with an accurate size and scale in accordance with the map. (ie, I don't want to spawn a giant player or tiny player that is not accurate to world scale).

How can I spawn an accurately scaled and sized player object in a 3D map? Please and thank you in advance.

private IEnumerator InitializePlayer()
    {
        Debug.Log("InitPlayer");
        Vector2d playerLatLon = new Vector2d(36.0966, -112.0985);  //new Vector2d(37.7873886618601, -122.397240448021);

        //scale gameObject to 1/100th of the map
        //transform.localScale = new Vector3(0.01f, 0.01f, 0.01f);

        //scale player to accurate world scale        
        

        //gameObject.transform.localScale = new Vector3(1f, 1f, 1f);
        Debug.Log("Height ->" + abstractMap.QueryElevationInMetersAt(playerLatLon));

        gameObject.transform.position = abstractMap.GeoToWorldPosition(playerLatLon, true);

        ////make the game object spawn on a flat surface on the terrain
        //gameObject.transform.position = new Vector3(gameObject.transform.position.x, abstractMap.QueryElevationInMetersAt(playerLatLon), gameObject.transform.position.z);

        yield return null;

    }

0 Answers0