Здравствуйте дорогие форумчане!
Столкнулся с такой проблемой.
Компилятор выдает ошибку на эти строки:
Код
x = transform.position.x * heightMap.width / size.x;
z = transform.position.z * heightMap.height / size.z;
Вот весь скрипт:
Код
using UnityEngine;
using System.Collections;
public class PlacerC : MonoBehaviour {
public Transform sand;
public Transform grass;
public Texture2D heightMap;
public Vector3 size;
int x;
int z;
// Use this for initialization
void Start () {
size.x = 300;
size.y = 10;
size.z = 100;
x = transform.position.x * heightMap.width / size.x;
z = transform.position.z * heightMap.height / size.z;
transform.position.y = Mathf.RoundToInt(heightMap.GetPixel(x ,z).grayscale*15);
}
// Update is called once per frame
void Update () {
}
}
Помогите подправить.
Заранее спасибо!!!