Basically a place script where my player will place a wall onto a build zone. It copies the rotation when its the buildzone is the same direction as my prefab but if I rotate my buildzone 90 and try place the block on top again it does rotate it just stays on 0.
#pragma strict
var prefab : Transform;
function Start () {
}
function Update(){
if(Input.GetMouseButtonUp(0)){
var ray : Ray = GetComponent.<Camera>().main.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;
if (Physics.Raycast(ray, hit,Mathf.Infinity)){
if(hit.collider.tag == "BuildZone" && "Wood"){
var placePos : Vector3 = hit.point;
placePos.y += 1;
placePos.x = Mathf.Round(placePos.x);
placePos.z = Mathf.Round(placePos.z);
// Instantiate (prefab, placePos, Quaternion.identity);
Instantiate(prefab, placePos, Quaternion.identity);
}
}
} }
I can post a screenshot if you don’t understand.
Anyone know whats up?