| 12345678910111213141516171819202122232425262728293031 |
- using UnityEngine;
- public class StartController : MonoBehaviour
- {
- public Terrain terrain;
- public GameObject player;
- // Start is called once before the first execution of Update after the MonoBehaviour is created
- void Start()
- {
- // Расположение модели игрока на поверхности (только для BoxCollider-а)
- var terrainCenter = terrain.terrainData.heightmapResolution / 2;
- var height = terrain.terrainData.GetHeight(terrainCenter, terrainCenter);
- //var collider = player.GetComponent<BoxCollider>();
- //var playerCenter = (collider.size.y / 2 - collider.center.y) * player.transform.localScale.y;
- //var location = new Vector3(
- // terrain.transform.position.x + terrain.terrainData.size.x / 2,
- // height + playerCenter,
- // terrain.transform.position.z + terrain.terrainData.size.z / 2);
- //player.transform.position = location;
- }
- // Update is called once per frame
- void Update()
- {
-
- }
- }
|