Witam. Mam takie pytanko. Czy z tego skryptu dałoby się zrobić tak, aby cube, który ma przypisany ten skrypt, kopiował się obok i/lub przed siebie? Jak tak to co musiałbym dodać do niego? Z góry dzięki za odpowiedź :D Pozdrawiam.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class kopiowanie : MonoBehaviour {
public GameObject podlozePrefab;
public float odstep = 0.01f;
void Start () {
}
// Update is called once per frame
void Update () {
if(Input.GetKey(KeyCode.LeftControl))
{
GameObject podloze;
podloze= (GameObject)Instantiate(podlozePrefab, Camera.main.transform.position + Camera.main.transform.forward, Camera.main.transform.rotation);
podloze.GetComponent<Rigidbody>().AddForce(Camera.main.transform.forward * odstep, ForceMode.Impulse);
}
}
}