So the question is the error I’m getting at line 53, column 72. I’m not exactly sure what I’m doing wrong as I’m pretty sure that gameObject.transform is legal.
Here’s the code:
#pragma strict
public var currentBlock : GameObject;
public var rotationOffset : float;
public var currentHand : GameObject;
public var hands : GameObject;
function Start () {
}
function Update () {
var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
var hit : RaycastHit;
if (Input.GetMouseButtonDown (0)) {
if (Physics.Raycast(ray,hit) ) {
if (hit.collider.tag == "Detector") {
//hit.collider.name
//hit.collider.tag
//hit.point
//hit.collider.gameObject.transform.position
//Destroy (hit.collider.gameObject);
var clone : GameObject;
var vec = currentBlock.transform.rotation.eulerAngles;
vec.x = vec.x + rotationOffset;
clone = Instantiate(currentBlock, hit.collider.gameObject.transform.position, Quaternion.Euler(vec));
}
}
}
if (Input.GetMouseButtonDown (1)) {
if (Physics.Raycast(ray,hit)) {
if(hit.collider.tag == "Ground") {
Destroy(hit.transform.gameObject);
}
}
}
if (Input.GetKeyDown("r") && rotationOffset != 360){
rotationOffset = rotationOffset + 90;
} else {
if (Input.GetKeyDown('r') && rotationOffset == 360){
rotationOffset = 0;
}
}
if (Input.GetKeyDown("e")) {
if(currentHand != null) {
currentHand.gameObject.transform.parent = null;
}
if (Physics.Raycast(ray,hit)) {
if(hit.collider.tag == "Movable") {
currentHand = hit.collider.gameObject;
currentHand.transform.parent = hands;
}
}
}
}