So I have a game where you place dominoes and tip them, pretty simple. I currently have a script to place my dominoes, but I can’t rotate them, nor can I see where they’re going to be placed. Maybe a transparent domino prefab that follows cursor until clicking?
Thanks in advance
My current code is here
var prefab : Transform;
function Update(){
if(Input.GetMouseButtonUp(0)){
var ray : Ray = GetComponent.().ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;
if (Physics.Raycast(ray, hit,Mathf.Infinity)){
if(hit.collider.tag == "Terrain"){
var placePos : Vector3 = hit.point;
placePos.y += .5;
placePos.x = Mathf.Round(placePos.x);
placePos.z = Mathf.Round(placePos.z);
Instantiate (prefab, placePos, Quaternion.identity);
}
}
}
}